Fix .table-responsive causing unexpected body scrollbar with visually… - #42901
Open
jyotirmoyghosh-me wants to merge 1 commit into
Open
Fix .table-responsive causing unexpected body scrollbar with visually…#42901jyotirmoyghosh-me wants to merge 1 commit into
jyotirmoyghosh-me wants to merge 1 commit into
Conversation
…-hidden content Give .table-responsive its own positioning context so an absolutely positioned .visually-hidden descendant (e.g. in a table header) is contained by the wrapper instead of bubbling up to the document, which was causing a phantom scrollbar in Chrome. Fixes twbs#41554
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.
Fixes #41554
Description
.table-responsivedidn't establish its own positioning context. A.visually-hiddenelement (which isposition: absolute) placed inside a scrolled.table-responsivewrapper (e.g. in a table header cell) had no positioned ancestor closer than the document, so its containing block effectively bubbled up past the wrapper. This caused Chrome to compute extra scrollable overflow on the document itself, producing an unexpected body-level scrollbar even though the table's own wrapper was already scrolling correctly.This PR adds
position: relativeto.table-responsive, giving it its own containing block so absolutely positioned descendants (like.visually-hiddencontent) are contained by the wrapper instead of leaking into page-level layout.Motivation & Context
Reported in #41554: a horizontally scrolled, wide table with
.visually-hiddentext in the last column of the table head produces an unexpected body scrollbar in Chrome (not Firefox). Possibly related: #41790, where.visually-hiddenon a<table>also takes up unexpected layout space in Safari/Chrome — likely the same underlying containing-block mechanism.Testing done
.table-responsivecomponent, and confirmed the fix holds for the scenario described (wrapper scrolled fully, no document-level scrollbar).npm run css-lintpasses.npm run css-testpasses (46 specs, 0 failures).Type of changes
Checklist
npm run lint)