Vanilla JS rewrite of tableselect / tableheader

Issue fork gin-3294539

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

saschaeggi created an issue. See original summary.

saschaeggi’s picture

Status: Active » Needs review
saschaeggi’s picture

DieterHolvoet’s picture

Functionality wise the table header & table select seems to work as before. How can we test the sticky header behaviour? Where is it enabled in core/contrib, or how do we enable it on a custom table?

saschaeggi’s picture

e.g. /admin/content

DieterHolvoet’s picture

Status: Needs review » Needs work
FileSize
145.8 KB

Found an issue: the table header is not aligned anymore with the table columns on /admin/content. It is when the table header is positioned normally, but it widens once the header detaches and becomes sticky.

Screenshot

saschaeggi’s picture

Status: Needs work » Needs review

Fixed. I also found another small issue when the initial page state would be scrolled and the sticky header is not showing up.
Can be reviewed again.

DieterHolvoet’s picture

Status: Needs review » Needs work

Still having the same issue as in the screenshot I posted. Tested using Chrome and Orion browsers.

saschaeggi’s picture

Strange, just tested again with Chrome, FF & Safari, works as expected 🤔

Make sure you have the latest version of this MR for testing.

DieterHolvoet’s picture

I tried again and I'm 100% sure the latest version of the MR is applied. The pixel value width is being applied to the table.sticky-header > thead th elements, and the width is being updated on window resize. My guess is that the pixel value is just somehow too big. Some context that might be relevant: I'm using the horizontal toolbar and some table columns are sortable.

saschaeggi’s picture

Status: Needs work » Needs review

Pushed an update. Still can't reproduce the bug reported by @DieterHolvoet

saschaeggi’s picture

Issue tags: +Drupal10
saschaeggi’s picture

Issue tags: +#Drupal10PortingDay, +Drupal 10 compatibility
saschaeggi’s picture

Kristen Pol’s picture

Issue tags: -#Drupal10PortingDay +Drupal 10 porting day

Fixing tag.

Kristen Pol’s picture

Issue tags: -Drupal10 +Drupal 10

Whoops... 2 tags needed fixing... fixing the other one now.

LittleCoding’s picture

Status: Needs review » Needs work
saschaeggi’s picture

Status: Needs work » Needs review
saschaeggi’s picture

Thanks again for reviewing another one @LittleCodding 💙
This is ready for a re-review ✌️

saschaeggi’s picture

Back to review 😊

LittleCoding’s picture

Status: Needs review » Needs work

In the JS file `gin/js/overrides/tableheader.js` The functions/methods 'stickyPosition', 'createStickyHeader', 'syncSelectAll', and 'handleResize' should be in their own name spaced object `Drupal.ginTableHeader`.

saschaeggi’s picture

Status: Needs work » Needs review

Thanks again @LittleCoding for taking the time.
Back to review 🏓

saschaeggi’s picture

saschaeggi’s picture

saschaeggi’s picture

saschaeggi’s picture

saschaeggi’s picture

batigolix’s picture

Assigned: Unassigned » batigolix
batigolix’s picture

I tested the patch and it applies well.

I checked 4 situations:
- table header in light mode
- table select in light mode
- table select in dark mode
- table drag in light mode

I did not find any issues.

  • saschaeggi committed 64c2803 on 8.x-3.x
    Issue #3294539: [JS Refactor] tableselect / tableheader
    
saschaeggi’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Status: Fixed » Closed (fixed)

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

berliner’s picture

Anyone else coming here looking the reason for the sticky header being too wide, as described first in #3294539-7: [JS Refactor] tableselect / tableheader, setting the table to `width: auto;` seems to fix it for me.