Repository navigation
fix(plugin-chart-table): align sticky header column dividers with table body - #42573
Conversation
…asuring the custom scrollbar width Reported by a customer: on Table chart, the sticky header's column dividers didn't line up with the body's dividers, worst at the rightmost column. getScrollBarSize() measured a native ~15px scrollbar, but the body actually renders an 8px custom webkit scrollbar, so the header was over-shrunk by ~7px. The measurement probe now applies the same custom scrollbar styling, and both the probe and the sticky table's scrollbar CSS pull from a single CUSTOM_SCROLLBAR_SIZE constant so they can't drift apart again.
|
Bito Review Skipped - Source Branch Not Found |
|
The flagged issue is correct. The To resolve this, you should separate the concerns: keep a utility that measures the actual native scrollbar width (without forcing custom styles) for general use, and use a constant for the custom scrollbar width where specifically needed (e.g., in Proposed Fix
Would you like me to implement these changes? I can also check the rest of the PR comments if you would like to address them as well. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #42573 +/- ##
==========================================
- Coverage 65.59% 65.58% -0.01%
==========================================
Files 2819 2819
Lines 160372 160388 +16
Branches 36617 36622 +5
==========================================
+ Hits 105188 105197 +9
- Misses 53120 53127 +7
Partials 2064 2064
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
🎪 Showtime deployed environment on GHA for 58a89eb • Environment: http://54.212.30.151:8080 (admin/admin) |
SBIN2010
left a comment
There was a problem hiding this comment.
LGTM!
It works perfectly during manual testing! Thanks for the fix.
Port of apache#43937 (f66843e), adapted to 5.0-mgdis. The header/footer wrappers were narrowed to `maxWidth - scrollBarSize`, which clips the shared fixed-layout colgroup whenever the JS-measured scrollbar width disagrees with the space the body actually reserves (browser, platform and zoom dependent). They now always keep the full `maxWidth` -- the colgroup is bounded by the sizer's clientWidth, itself bounded by `maxWidth`, so it can never overflow them -- and carry `scrollbar-gutter: stable` like the body, so their reported clientWidth stays consistent with the body's for the synced horizontal `scrollLeft`. Upstream's `getCustomScrollBarSize()` (apache#42573) is deliberately not ported: it only makes sense alongside the custom 8px `::-webkit-scrollbar` styling introduced by apache#35338, which 5.0 doesn't have -- the table body here renders a native scrollbar, so measuring an 8px probe would re-introduce a ~7px misalignment on Chrome/Edge. PLAID-147319 Co-Authored with Claude Code
SUMMARY
In the Table chart, the sticky column-header divider lines can be horizontally offset from the table body's column dividers (worst at the right-most column), making the grid look misaligned whenever the body has a vertical scrollbar.
Root cause: the sticky header and the scrollable body are rendered as two separate
<table>elements. To keep their columns aligned,useStickyshrinks the header container bygetScrollBarSize()when the body scrolls vertically. The body's scrollable area uses a custom thin scrollbar (::-webkit-scrollbar { width: 8px }), butgetScrollBarSize()measured a hidden probe element with no custom scrollbar styling — so on Chrome/Edge it returned the native scrollbar width (~15px) instead of the 8px that actually renders. The header was therefore shrunk by ~15px while the body's real scrollbar only consumes 8px, throwing every column divider ~7px out of alignment.CHANGE
CUSTOM_SCROLLBAR_SIZEconstant (exported fromgetScrollBarSize.ts) and use it for the body's::-webkit-scrollbarwidth/height inuseSticky.tsx, so the header-shrink amount and the body's rendered scrollbar can't drift apart.getScrollBarSize(), apply the same::-webkit-scrollbarrule to the hidden measurement probe (via a scoped<style>, since pseudo-elements can't be set inline) so the measured width matches what actually renders.TESTING INSTRUCTIONS
getScrollBarSize.test.tsverify the probe is measured with the shared custom scrollbar size and that the constant stays in sync with the rendered style.ADDITIONAL INFORMATION