-
Notifications
You must be signed in to change notification settings - Fork 8
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
Table height does not account for horizontal scrollbar #2525
Conversation
packages/storybook/src/nimble/table/table-fit-rows-height-matrix.stories.ts
Show resolved
Hide resolved
packages/storybook/src/nimble/table/table-fit-rows-height-matrix.stories.ts
Outdated
Show resolved
Hide resolved
β¦ix.stories.ts Co-authored-by: Milan Raj <[email protected]>
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.
I verified in macOS Safari and Firefox (both of which show overlay scrollbars) that the table fit rows height stories behave correctly. It doesn't reserve extra space for the horizontal scrollbar and it doesn't cause an unnecessary vertical scrollbar to appear when the horizontal one is shown. π
Pull Request
π€¨ Rationale
Fixes #2520
π©βπ» Implementation
The issue is that when the horizontal scrollbar was present while styling the table with a height of
tableFitRowsHeight
, a vertical scrollbar would be present because the height token's value didn't account for the height of the horizontal scrollbar. Now, the virtualizer's ResizeObserver hander calculates the height of the horizontal scrollbar (which is 0 if there isn't a horizontal scrollbar), and exposes that value as an@observable
, similar toscrollHeight
. As a result, the table can use both values in its calculation oftableFitRowsHeight
, resulting in no vertical scrollbar when using the token (unless the max-height of the table is reached).π§ͺ Testing
Manually tested, including the following scenarios to ensure the auto height of the table adjusted correctly as a horizontal scrollbar was added/removed:
column-visible
on a columnNew auto tests, including chromatic test that loads a table with auto height and a horizontal scrollbar
β Checklist