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.

CommentFileSizeAuthor
#3 after-fix.png108.46 KBkksandr
#3 before-fix.png110.33 KBkksandr

Issue fork drupal-3418863

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

kksandr created an issue. See original summary.

kksandr’s picture

Status: Active » Needs review
StatusFileSize
new110.33 KB
new108.46 KB
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

If 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.

saschaeggi’s picture

@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 px as 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.

smustgrave’s picture

Thanks 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

smustgrave’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs tests

This change seems so small I take back my previous comment for tests. Lets see what the committers say.

  • nod_ committed db76de26 on 11.x
    Issue #3418863 by kksandr, saschaeggi: Setting width for sticky-header...

  • nod_ committed e9723570 on 10.3.x
    Issue #3418863 by kksandr, saschaeggi: Setting width for sticky-header...

  • nod_ committed 5a4f9ee2 on 10.2.x
    Issue #3418863 by kksandr, saschaeggi: Setting width for sticky-header...

nod_’s picture

Version: 11.x-dev » 10.2.x-dev
Status: Reviewed & tested by the community » Fixed

all good, thanks :)

Committed db76de2 and pushed to 11.x. Thanks!

saschaeggi’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.