-
Notifications
You must be signed in to change notification settings - Fork 509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(bcd): Sticky headers for BCD table, on desktop #11345
base: main
Are you sure you want to change the base?
Conversation
bedd709
to
b48b0fa
Compare
This pull request has merge conflicts that must be resolved before it can be merged. |
|
b48b0fa
to
9d76a58
Compare
On desktop with sufficient browser height (determined by a media query on `(min-height: $screen-height-place-limit)`), make the headers of the BCD table sticky against the bottom of the sticky page header. Signed-off-by: FeRD (Frank Dana) <[email protected]>
36d001e
to
4f8d2b2
Compare
This pull request has merge conflicts that must be resolved before it can be merged. |
Summary
On desktop with sufficient browser height (determined by a media query on
(min-height: $screen-height-place-limit)
), make the headers of the BCD table sticky against the bottom of the sticky page header.Fixes #5417
Problem
On pages with (vertically) long compatibility tables (see, for example, https://developer.mozilla.org/en-US/docs/Web/API/Element), the headers scroll off the top of the screen as the user scrolls down, losing useful context.
Solution
This takes a different approach than #8541 did, by making the table headers sticky in the page scroll context rather than giving the table its own local scroll context. Hopefully that will alleviate some of the issues that cropped up in that other PR.
In my testing this seems to work well. In fact, I was inspired to open this PR when, after reading this Discussion, I noticed / reminded myself that I've been running with the "moral equivalent" of these changes as a local userstyle since last December. So, I've been silently testing these changes without issue for the past 7 months. Of course, that's still a very narrow set of browsers, screen sizes, etc. tested against.
Screenshots
Before
Wide:
Narrower:
After
Wide:
At wider breakpoints, the table is allowed to overlap the page TOC when scrolling past it, which I don't personally feel is a problem. But, it's worth mentioning.
Narrower:
At narrower breakpoints, this causes the entire page to be horizontally scrollable, instead of just the table, which I actually feel is an improvement. (It doesn't make the rest of the page content any wider, so none of it goes offscreen and the only element that needs horizontal scrolling is still the BCD table.)
Also, as can be seen in the Narrower screenshots, this change has a limitation (shared with the left-hand sidebar) in that its
top
position is fixed atvar(--sticky-header-with-actions-height)
, which ==98px
. So, on narrower screens where the sticky header wraps, it will be taller than98px
, causing part of both sticky elements to be cut off at the top.I feel that limitation could be better addressed by making
--sticky-header-with-actions-height
a dynamic variable that adjusts itself to account for wrapping. That would solve it for both sticky elements.How did you test this change?
Created a local userstyle with the same style modifications.