Problem/Motivation

If CSS variable --drupal-displace-offset-top is not defined, tableheader is not sticky anymore, because this one have no fallback value https://git.drupalcode.org/project/drupal/-/blob/11.x/core/themes/claro/...

Bug was catched here https://www.drupal.org/project/navigation/issues/3432222

Steps to reproduce

1. Standard profile installation
2. composer require drupal/navigation
3. drush en -y navigation
4. checkout in MR from here https://www.drupal.org/project/navigation/issues/3432222 (or if this task is already fixed - no need), just use navigation module as it is
5. generate several nodes so it's enough to get sticky table header on this page "/admin/content" (faster with devel generate, than manually)
6. scroll down on "/admin/content" -> no sticky table header

Proposed resolution

Replace

top: var(--drupal-displace-offset-top);

by

top: var(--drupal-displace-offset-top, 0px);

Issue fork drupal-3432298

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

kostyashupenko created an issue. See original summary.

kostyashupenko’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Was wondering if we need a test but the change is so small doubt it would be worth it, if tests would even be possible.

  • nod_ committed f0dfe7d4 on 11.x
    Issue #3432298 by kostyashupenko, smustgrave: Sticky table header is not...

  • nod_ committed 2071823a on 10.3.x
    Issue #3432298 by kostyashupenko, smustgrave: Sticky table header is not...

  • nod_ committed 59284ed7 on 10.2.x
    Issue #3432298 by kostyashupenko, smustgrave: Sticky table header is not...

nod_’s picture

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

Committed f0dfe7d and pushed to 11.x. Thanks!

javitan’s picture

StatusFileSize
new854 bytes

The changes of the branch didn't work for me, so I overridden the CSS value to use top: 0 instead. This is working for Drupal 10.2.4.

Status: Fixed » Closed (fixed)

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

dylanmehl’s picture

The code modification in commit f0dfe7d addresses the majority of our issues related to tables with sticky headers. I have attached a patch file to my comment for those who wish to apply the fix as a patch.

Update: I made a small mistake in my previous patch, I have fixed the issue, uploaded the new patch and hide the previous patch.

dylanmehl’s picture

dylanmehl’s picture