Skip to content

Keep the pinned sidebar and ToC from scrolling away under the widget - #4008

Open
paoloredis wants to merge 1 commit into
mainfrom
DOC-7064
Open

paoloredis wants to merge 1 commit into
mainfrom
DOC-7064

Conversation

@paoloredis

@paoloredis paoloredis commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

The Qualified widget stamps its overflow trap on

with contain: layout !important. Layout containment makes the containing block for every position: fixed descendant, so the pinned left sidebar (nav#sidebar, position: fixed) and the right table of contents scroll away with the page content on every browser where the widget runs. This is why the rails stay pinned in a Firefox profile with tracking protection (widget blocked) but vanish in Chrome.

The widget adds the containment to keep float-based layouts from collapsing under its overflow: clip override. Our

has no floated children (verified: zero floats, main height identical with and without containment), so dropping it is safe. The rule is element-qualified (main[data-q-overflow-trap]) to out-rank the widget's attribute-only selector, and only matches while the widget has marked the element.

Verified on the live staging page in both Chrome and Firefox: with the rule injected, the sidebar and ToC stay pinned at their offsets while the page scrolls; without it they leave the viewport. Page height and scroll range unchanged.


Note

Low Risk
Single scoped CSS override active only when the third-party widget marks <main>; intended to restore fixed positioning without changing scroll height.

Overview
Adds a Qualified widget override so pinned doc chrome stays fixed while scrolling.

When the widget marks <main> with data-q-overflow-trap, it applies contain: layout, which turns <main> into the containing block for position: fixed elements. That caused the left sidebar and right table of contents to scroll with the page instead of staying pinned (notably in Chrome when the widget loads).

The new rule main[data-q-overflow-trap] { contain: none !important; } drops that containment only while the widget has stamped <main>, using an element-qualified selector so it wins over the widget’s attribute-only rule. Comments note this is considered safe here because <main> has no floated children—the containment was only to protect float layouts under the widget’s overflow clip.

Reviewed by Cursor Bugbot for commit a44fc6c. Bugbot is set up for automated code reviews on this repo. Configure here.

The Qualified widget stamps its overflow trap on <main> with
contain: layout !important. Layout containment makes <main> the
containing block for every position: fixed descendant, so the pinned
left sidebar (nav#sidebar, position: fixed) and the right table of
contents scroll away with the page content on every browser where the
widget runs. This is why the rails stay pinned in a Firefox profile
with tracking protection (widget blocked) but vanish in Chrome.

The widget adds the containment to keep float-based layouts from
collapsing under its overflow: clip override. Our <main> has no floated
children (verified: zero floats, main height identical with and without
containment), so dropping it is safe. The rule is element-qualified
(main[data-q-overflow-trap]) to out-rank the widget's attribute-only
selector, and only matches while the widget has marked the element.

Verified on the live staging page in both Chrome and Firefox: with the
rule injected, the sidebar and ToC stay pinned at their offsets while
the page scrolls; without it they leave the viewport. Page height and
scroll range unchanged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

DOC-7064

@github-actions

Copy link
Copy Markdown
Contributor

🧠 Redis Memory

Found 5 related items from repository history (5 new this commit):

Memory updated at a44fc6c

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@paoloredis paoloredis self-assigned this Sep 15, 2026

@mich-elle-luna mich-elle-luna left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants