-
Notifications
You must be signed in to change notification settings - Fork 514
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): make BCD table's header sticky #8541
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works great on desktop, but removing the overflow: auto
on .table-container
exposes a couple of bugs:
first, we've got some sort of minimum sizing issue with the table as a whole when approaching the screen-lg
breakpoint:
second, once we're in the screen-lg
breakpoint we relied on the prior overflow: auto
behaviour to be able to scroll the overflowing table around, now the whole page scrolls and it overflows in a not very nice way:
since we can't keep that overflow: auto
due to it resetting the scrolling context for the sticky element, I think what we'll have to do is:
- below
screen-sm
, keep the behaviour as it is - from
screen-sm
to belowscreen-xl
: set the table to a max height of100vh - the top navigation
and width of the content section, set overflow scroll, and make the header sticky to the scroll context of the table screen-xl
and above: keep the behaviour as exists now in this pr (with a fix for the first problem above when approaching the "lg limit"), no scrolling in the table itself - the whole page scrolls and the header is sticky to the page itself
@LeoMcA The first problem occurs even for To me, the ultimate source of problems is the code blocks in the BCD tables. Is it feasible to add |
@LeoMcA I changed the scope of this PR down to only for Screenshot on the A weird phenomenon is that Now I'm not so sure if making BCD tables sticky is a good idea after all. |
I finally managed to make the header sticky and its border not drifting away when scrolling. However:
In the screenshots below,
|
@yarusome thanks for all your work here, and apologies for the long delay - I was out sick, then had some rapidly approaching deadlines It's a shame that position sticky can't "skip" a scrolling context - if it could I think this would be purely an enhancement, and easy to merge - however, since it isn't, and we change the behaviour of the BCD tables quite a bit, I'll need to discuss this one with the rest of the team. The concern I have with making the BCD table itself scrollable is it's not immediately obvious that there's more to see when scrolling, and it's easy to skip over information when then scrolling the page. The concern I have with forcing word breaking on the code blocks is it's pretty ugly breaking mid-word - this is something I've tackled before in the collections feature by adding
I'll push a commit adding the |
Summary
Fixes #5417.
Problem
This PR solves the problem that lengthy BCD tables are less easy to read when the headers are scrolled out of the viewport.
Solution
This PR makes the table header sticky.
Screenshots
Before
After