diff --git a/src/ui/panelLayoutController.js b/src/ui/panelLayoutController.js index 7b21b72d09..1043108301 100644 --- a/src/ui/panelLayoutController.js +++ b/src/ui/panelLayoutController.js @@ -104,6 +104,8 @@ export class PanelLayoutController { this._rightStackReconsiderAutoCollapse = false; this._rightStackResizeObserver = null; this._storiesCardObserver = null; + this._storiesCardShownHandler = null; + this._storiesHost = null; this._cockpitLayoutFrame = null; this._cockpitLayoutTimer = null; this._leftPanelStack = document.getElementById('left-panel-stack'); @@ -260,8 +262,12 @@ export class PanelLayoutController { }); // The Stories card comes and goes inside the Stories view; only its // arrival or departure moves the rail, not the view's other changes. + // It fades in from transparent, which the layout skips, so the end of + // that fade (also replayed when the card is shown again after being + // hidden) lays the rail out once more. const storiesHost = document.getElementById('gev-stories-host'); if (storiesHost) { + this._storiesHost = storiesHost; this._storiesCardObserver = new MutationObserver((records) => { if (records.some(movesStoriesCard)) this._scheduleRightPanelLayout(); }); @@ -269,6 +275,13 @@ export class PanelLayoutController { subtree: true, childList: true, }); + this._storiesCardShownHandler = (event) => { + if (event.target?.id === 'hPop') this._scheduleRightPanelLayout(); + }; + storiesHost.addEventListener( + 'animationend', + this._storiesCardShownHandler, + ); } const hud = document.getElementById('intel-hud'); if (hud) { @@ -493,6 +506,11 @@ export class PanelLayoutController { this[field]?.disconnect(); this[field] = null; } + this._storiesHost?.removeEventListener( + 'animationend', + this._storiesCardShownHandler, + ); + this._storiesHost = this._storiesCardShownHandler = null; for (const field of [ '_leftStackHudTransitionHandler', '_rightStackHudTransitionHandler',