[Test] Test sticky positioning on thead#5288
Conversation
Add sample styles to show what would be required for border-collapse: separate
…ky-table-header
|
@mejiaj @mahoneycm Note: I did a bit more digging after our conversation about this last week, looking mostly into modern recommendations for styling tables, but did not find anything that made me want to shift my approach. Happy to hear if anyone has any recommendations for improvement. There are a few items that need team input and I've tagged items those items with the I have tested the following items:
Other considerations
|
mahoneycm
left a comment
There was a problem hiding this comment.
Thanks for your work to make this easily viewable! Tests are working great for me and I like implementing sticky on thead. That seems like the most logical approach to me.
- Works on default
- No issues on sticky thead across variants
- Works with borderless variant
- like the current iteration using
$theme-table-background-color - What’s the best way for users to change the table header color with this method?
- If we created a
$theme-table-borderless-background-colorand set it to equal$theme-table-background-color, users could override to use$theme-table-header-background-colorif they want to change borderless header background color.
- If we created a
- like the current iteration using
- Works on striped variant
- Works on sortable as expected with sticky on thead
- Cannot find solution for scrollable tables
- Seems to break from
_normalize.scssoverflow-x: hidden - Ran into a slightly similar issue on my copy button PR and resolved this by setting
overflow: initial. I wasn't able to replicate here. - Some googling showed me that some users prefer
overflow: cliptooverflow: hiddento resolve errors withposition: sticky, but I wasn't able to get anything to work: https://www.terluinwebdesign.nl/en/css/position-sticky-not-working-try-overflow-clip-not-overflow-hidden/ - I agree that this doesn't have to be a blocker but rather a future enhancement
- Seems to break from
Testing sticky
Can we clarify at the end of this note to use storybook controls? Example: …applying sticky to thead via StorybookJS controls I tested without issues with the following Mac browsers:
Table color setting
We currently have the following settings:
Table sortable
Note: we should consider templatizing some of our tables, so they're not hardcoded and can be re-used. Scrollable and stacked variants
We'd need to create a SPIKE issue to research this.
I'd be OK with handling this in guidance, for now. If we're clear that sticky header is made for certain variants.
My immediate thought is "no" for this initial attempt. We can add it as an enhancement later on if necessary. Other
The headers can be any height based on content, so makes sense if it doesn't work in units. |
|
Closing because we no longer need this test PR |
Summary
This PR is built as a test for adding sticky positioning to table headers. This PR:
position: stickyon thetheadelement instead of thethcells.stickyheader,scrollable, and multiple header rows on all table variants for improved testing.Related pull requests
This PR is based on and is a test for PR #5074
Preview link
Preview link: Table component