From 4d42c56bdfb961a3f334e29798c7a737d0df6858 Mon Sep 17 00:00:00 2001 From: Sameh Khamis Date: Wed, 18 Nov 2026 15:50:34 -0800 Subject: [PATCH] Lay the right panels out again when the welcome stops hiding the Stories card The welcome hides the card while it is up and while BROWSE STORIES loads, so the right column started level with the left one; when the welcome closed, the card showed over the column until something else moved the panels. The column is laid out again when the welcome is removed or its loading class comes off. Co-authored-by: Manjunath Paparaju --- src/ui/panelLayoutController.js | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/src/ui/panelLayoutController.js b/src/ui/panelLayoutController.js index bd86d7a4b5..1a3783eaa1 100644 --- a/src/ui/panelLayoutController.js +++ b/src/ui/panelLayoutController.js @@ -68,10 +68,25 @@ const RIGHT_STACK_OBSTACLE_SELECTOR = [ '#world-timeline', ].join(', '); /** True when a mutation adds or removes the Stories card (`#hPop`). */ +const OPENING_STORIES = 'first-run-opening-stories'; +/** + * True when a mutation can show or hide the Stories card (`#hPop`): the card + * itself coming or going, or the welcome that hides it (`#first-run-launcher`, + * and the body class it sets while BROWSE STORIES loads) ending. + */ function movesStoriesCard(record) { + if (record.type === 'attributes') + return ( + (record.oldValue || '').split(/\s+/).includes(OPENING_STORIES) !== + record.target.classList.contains(OPENING_STORIES) + ); for (const list of [record.addedNodes, record.removedNodes]) for (const node of list) - if (node.id === 'hPop' || node.querySelector?.('#hPop')) return true; + if ( + ['hPop', 'first-run-launcher'].includes(node.id) || + node.querySelector?.('#hPop, #first-run-launcher') + ) + return true; return false; } @@ -276,6 +291,18 @@ export class PanelLayoutController { subtree: true, childList: true, }); + const welcomeHost = document.querySelector('[data-gev-view="welcome"]'); + if (welcomeHost) + this._storiesCardObserver.observe(welcomeHost, { + subtree: true, + childList: true, + }); + if (document.body) + this._storiesCardObserver.observe(document.body, { + attributes: true, + attributeFilter: ['class'], + attributeOldValue: true, + }); this._storiesCardShownHandler = (event) => { if (event.target?.id === 'hPop') this._scheduleRightPanelLayout(); };