Problem/Motivation
Hello, when switching to VanillaJS, setting the width of the sticky table header (tableheader.js) broke due to the lack of units of measurement.
Steps to reproduce
Create a table with a sticky header in the view, activate the sticky header and check the width of the sticky header table.
You also need your theme to add the .sticky-enabled class to the table. Therefore, the Claro admin theme from core is not suitable for testing as it does not do this. The Gin theme was used for testing.
Proposed resolution
Add units (px) to the .outerWidth() result.
Comments
Comment #3
kksandr commentedComment #4
smustgrave commentedIf this is only reproducible with Gin and can't be replicated in core should the fix go over there?
Will need a test case showing the issue.
Comment #5
saschaeggi@smustgrave the culprint of the issue seems to be
his.$stickyTable[0].style.width = this.$originalTable.outerWidth();as
outerWidth()will provide a number without a unit and therefore can cause issues in (some) browsers (like Firefox).The MR adds
pxas a unit to being more specific which fixes the issue.It only happens if
recalculateSticky()is involved. So I don't think this is an issue related to Gin.Comment #6
smustgrave commentedThanks for digging into it. Maybe this doesn't require tests after all? But would be nice to be able to check claro for the bug
Comment #7
smustgrave commentedJust curious, does #3432298: Sticky table header is not sticky if --drupal-displace-offset-top is not defined have any impact here?
Comment #8
smustgrave commentedThis change seems so small I take back my previous comment for tests. Lets see what the committers say.
Comment #13
nod_all good, thanks :)
Committed db76de2 and pushed to 11.x. Thanks!
Comment #14
saschaeggi