Repository navigation
Keep the right-panel toggle and table-of-contents rail mounted while hidden - #6490
Merged
Merged
Conversation
added 2 commits
October 28, 2026 17:59
Opening the panel unmounted the thread header's toggle and closing it inserted the button again. Inserting or removing an element forces :has() invalidation, so with plugin or theme CSS that uses :has() each toggle restyled the whole page before the panel started moving. Keep the button mounted and hide it with display:none and inert while the panel's own control owns closing. Its label stays Show right panel while hidden, so label-based selectors keep matching the visible control.
The rail unmounted once the scroll overlay dropped below its width breakpoint. Opening the right panel on a wide window crosses that breakpoint mid-transition, so the rail was removed or inserted during the animation and triggered a second full-page restyle. Keep the rail mounted and hide it with display:none and inert below the breakpoint.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Human comments
What was wrong
Toggling the right panel inserted or removed DOM nodes that do not need to change. On desktop the thread header's toggle button is unmounted while the panel is open and mounted again on close. On windows wider than about 1120 px, the table-of-contents rail is also unmounted or remounted mid-slide when the timeline crosses its 56 rem breakpoint. In Chromium, inserting or removing an element triggers
:has()invalidation. With plugin or theme CSS that uses:has(), each of these restyled the whole page: once before the panel started moving, and on wide windows again during the slide. Details and measurements are in #6489.What changed
ThreadDetailHeader: the right-panel toggle stays mounted whenever the header owns it. While the panel's own control owns closing on desktop, it is hidden with thehiddenclass andinert, so it is out of the accessibility tree and tab order, as it was when unmounted. Its label stays "Show right panel" while hidden, so selectors that matcharia-label^="Show right panel"or"Hide right panel"still find exactly one visible control in each state. Compact behavior is unchanged.ThreadTableOfContents: the rail stays mounted below the width breakpoint and is hidden with thehiddenclass andinertinstead of being unmounted. The outline request is still gated on visibility.ThreadTableOfContents.tsxdiff is re-indentation from removing one conditional;git diff -wshows the four-line change.How you verified
New tests:
ThreadDetailHeader.test.tsx"keeps one right-panel toggle mounted and hides it while the panel is open" andThreadTableOfContents.test.tsx"keeps the rail mounted but hidden while the pane is too narrow". Both fail againstmain's components and pass with this change. The table-of-contents test'sResizeObservermock gained a helper to deliver a new width.pnpm exec turbo run typecheck lint --filter=@bb/apppasses, with no new lint findings on changed lines.oxfmt --checkpasses on the changed files.Related suites pass: the header and table-of-contents tests,
ThreadSecondaryPanel.collapseControl,ThreadDetailSecondaryContent,SplitThreadArea,RootComposeRightPanelToggle,PluginPanelRightPanelHostandtheme-preview-fixture-anatomy(212 tests).Manual check in headless Chromium: production builds of
mainand of this branch, served against the same local server with about 35 plugin stylesheets and a custom theme. 4× CPU throttling; median of five repeated toggles, clicking the visible control.main→ this PRmain→ this PRThe compact path is unchanged by this PR. Earlier runs of both builds measured 196–218 ms there, so the 390 px difference is within run-to-run variation.
Accessibility tree, ⌘J, and the visible toggle's labels (Show / Hide) are identical to
mainin the open and closed states at 1440 px and 390 px.Limits:
ExpandableTimelineRowand causes a separate long frame onmainand on this branch alike. It is the same class of problem and could be a follow-up.Fixes #6489