[EuiTable/EuiBasicTable/EuiInMemoryTable] Add always-visible sticky scrollbar#9674
Conversation
…lbar` component and the usage to `EuiTable` for best compatibility
| </EuiTableIsResponsiveContext.Provider> | ||
| </table> | ||
| </div> | ||
| <> |
There was a problem hiding this comment.
This should not result in snapshot changes unless stickyScrollbar is explicitly enabled for a table, which is what we want.
| fireEvent.pointerMove(track, { | ||
| clientX: 150, | ||
| }); | ||
| const pointerDownEvent = new MouseEvent('pointerdown', { |
There was a problem hiding this comment.
This is needed for React 17 test runs. I explored replacing this logic with @testing-library/user-event but it would require upgrading that library.
…de additional context in JSDoc
| @@ -0,0 +1 @@ | |||
| - Added experimental support for always-visible sticky horizontal scrollbars in `EuiTable`, `EuiBasicTable` and `EuiInMemoryTable` useful for dense tables that exceed the height of the viewport. This feature is currently opt-in and can be enabled by setting `stickyScrollbar: true`. | |||
There was a problem hiding this comment.
If it's experimental, should we mark it as beta, add it to the Beta schedule and add a note in the docs?
There was a problem hiding this comment.
It's marked as beta in JSDoc, and yeah, I'm going to add it to our Beta schedule!
…t from EuiBasicTable docs
acstll
left a comment
There was a problem hiding this comment.
🟢 I tried breaking it but couldn't, works really well. (Did not test on a touch screen device, but there scrolling happens mostly via gestures, no? 🤔). Left a single non-blocking comment for your consideration.
| * This mock doesn't provide a real IntersectionObserver implementation | ||
| * and should only be used for simple assertions. | ||
| * Use Cypress to test more complex scenarios end to end. |
There was a problem hiding this comment.
thanks for adding the comment 💚
💚 Build Succeeded
History
cc @tkajtoch |
💚 Build SucceededHistory
cc @tkajtoch |
Summary
Resolves #9620
This PR adds an opt-in, always-visible sticky horizontal scrollbar to EuiTable, EuiBasicTable, and EuiInMemoryTable to help users without trackpads scroll table contents horizontally.
Without this, scrolling the table horizontally requires one of the following:
This feature is disabled by default and can be enabled by setting the
stickyScrollbarprop totrue. When disabled, it doesn't register any event listeners or observers and doesn't modify the DOM.Note: The styles applied to the virtual scrollbar are made to resemble the native scrollbar styles as closely as possible, however, every platform renders scrollbars differently. We standardize scrollbar background and track colors in our global styles. It is expected that the virtual scrollbar will not look 100% the same on Windows or Linux - Windows adds left and right buttons, and Linux differs by distro, GUI library, and more.
API Changes
EuiTable,EuiBasicTable,EuiInMemoryTablestickyScrollbarScreenshots
sticky.scrollbar.before.mov
sticky.scrollbar.after.mov
Safari:
safari.mov
Chromium on Ubuntu + Gnome:
ubuntu.gnome.chromium.mov
Chromium on Debian + KDE:
debian.kde.chromium.mov
Firefox on Debian + KDE:
debian.kde.firefox.mov
Chromium on Debian + XFCE:
debian.xfce.chromium.mov
Firefox on Debian + XFCE:
debian.xfce.firefox.mov
Performance
Measurements done by manually resizing the viewport - not suitable for 1:1 comparison.
When
stickyScrollbaris enabled, rendering and painting time grows by ~60ms, and scripting by ~25ms. This is fully expected and considering that the virtual scrollbar element style refreshes on every resize and scroll event, the resource cost is actually pretty minimal. UsingResizeObserverandIntersectionObserversynchronized withrequestAnimationFrameresults in grade A performance. I consider these numbers good and see no objections shipping it as-is.Impact Assessment
Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.
🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.Impact level: 🟢 Low to None
Release Readiness
Documentation: {link to docs page(s)}Figma: {link to Figma or issue}Migration guide: {steps or link, for breaking/visual changes or deprecations}QA instructions for reviewer
stickyScrollbaris enabledChecklist before marking Ready for Review
QA: Tested docs changesBreaking changes: Addedbreaking changelabel (if applicable)Reviewer checklist