Sticky headers in view with grouped results

Created on 13 September 2024, 2 months ago
Updated 21 September 2024, about 2 months ago

Problem/Motivation

When using "sticky headers" in a view where rows are groupped by one of the fields, title of first group is being replaced by duplicated header of the table.
In result I can see headers twice, but header of the first group is gone, as seen on the screenshot:

Steps to reproduce

  1. Enable Gin admin theme
  2. Create new view with some fields, displayed as a table
  3. In Format: Settings select any field as Grouping field Nr.1
  4. In the same form enable "Drupal style sticky table headers"
  5. Observe dupliacted table headers, hiding name of the first group

Tested on Drupal 10.3.5 with Gin 8.x-3.0-rc13

🐛 Bug report
Status

Needs review

Component

Code

Created by

🇵🇱Poland besek

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @besek
  • Status changed to Needs review about 2 months ago
  • I have fixed this kindly used the attached patched and its working for both content and content view

  • 🇮🇳India milanchourasia

    I have reviewed and applied above patch.
    Patch No. : 3474245-1

    Its working fine on both places :

    1. Content
    2. ContentView

    I have also attached screenshot for better reference.

  • 🇵🇱Poland besek

    The patch from #3 works fine. Thanks @amitnar. Would you create MR?

  • Merge request !504Update 2 files → (Open) created by amitnar
  • Pipeline finished with Success
    about 2 months ago
    Total: 181s
    #290309
  • 🇮🇳India arunkumark Coimbatore

    As per comment #7, MR is created.
    Moving to Needs Review.

  • Hi

    Reviewed this issue, works fine after applying MR.
    Gin theme version 8.x-3.0-rc13
    Drupal version 11.0.5-dev

    Steps taken

    1. Enable Gin admin theme
    2. Create new view with some fields, displayed as a table
    3. In Format: Settings select any field as Grouping field Nr.1
    4. In the same form enable "Drupal style sticky table headers"
    5. Observe dupliacted table headers, hiding name of the first group.

    This issue can be moved ahead.
    RTBC +

  • 🇬🇷Greece iro

    The should only be one visible header at any time.
    At the given screenshots it is clear that this is not the case.

  • 🇵🇱Poland besek

    @iro, thanks for checking!

    The reason why there are two headers is caused by the fact that we are using "group by column" option and default Drupal behavior is to add separate header to every group created this way. Please see how it looks on Claro: claro_views_groupped_table.png

    However, sticky header on Claro works bit better, because it is moving only within one table and when it reaches the top of the screen, second header becomes sticky - all of them are working only within own table. While in Gin, the header that becomes sticky is always the first header from the first table and it travels through all of the page, creating an effect of duplicated headers from time to time. The other implication is that if tables has different width of the columns, this first header that became sticky is not aligned with the columns on nect tables.

    So, in my opinion, the original bug here has been fixed (as sticky header is not covering group headers anymore), however there is still issue with how sticky headers are working in Gin. But it would probably require separate issue? I'm happy to report separate issue on this, unless anybody feels different?

  • @besek kindly create another ticket as discussed in your comment If there is any issue in this ticket kindly provide the correct information with a screen-shot so that we can fix this.

    Thanks

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I'm not sure we need a separate issue for this. It even seems that the problem is more broad than the issue title suggests because I'm having that same problem with a duplicate table header for a table WITHOUT using any grouping. Here is an example:

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Here is some extra observation that may help to find the source of the issue:

    The view above comes in 2 flavours: as a page and as a block. When going to the page, the sticky table header works just fine. When going to a page where that view is embedded as a block, then the table header is duplicated.

    Now, that sounds like the block wrapper plays a role here. And that would relate to the initial issue with the view being grouped. In both cases, there are extra wrappers involved that probably break some selectors that would otherwise work just fine.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Another step forward: for the table inside a block, not as a page, when we remove the top property from table.gin--sticky-table-header, then both table headers are aligned one over the other, and it looks as if there is only one table header as it should be. I'm pretty sure, that would "fix" the visual issue for grouped tables as well.

    However, when doing this, the sticky header isn't visible when the user scrolls down, as then the top toolbar comes into play and overlaps that sticky header.

    I don't know, if and how we can resolve this, but at least we may now know where this is coming from.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    I've created the MR !512 which fixes the sticky table header display for views in a block. Please try that with the grouped views as well.

    Afterwards, we need to find out, how we can make that work together with the top toolbar.

  • 🇩🇪Germany jurgenhaas Gottmadingen

    Sorry, for all the noise, but I discovered something additional: in my case, the view block is embedded into a wrapper which comes from the collapsiblock module. When I disable that wrapper for this view block, then Gin works correctly without any patch or MR. So, I wonder if something similar is happening with the grouped blocks?

  • 🇧🇪Belgium Selfirian

    I'll review this one

  • Merge request !514Draft: Resolve #3474245 "Fixed table headers" → (Closed) created by Selfirian
  • 🇧🇪Belgium Selfirian

    Hello,

    Sorry for the MR!514, I'm still trying to figure this thing out.

    Anyhow I found a way to push my changes, yeaah :)

    I've commented out some JS because that was causing some issues with these sticky headers IMO, for the rest I followed this approach: https://css-tricks.com/position-sticky-and-table-headers/

    Sticky headers for tables can be done in pure css so why not do that.

    I just couldn't figure out how to keep the borders once they became sticky...

  • Pipeline finished with Failed
    about 1 month ago
    Total: 605s
    #310786
  • Pipeline finished with Success
    about 1 month ago
    Total: 208s
    #310801
  • Pipeline finished with Failed
    about 1 month ago
    Total: 184s
    #310887
  • 🇧🇪Belgium Selfirian

    I've removed my attempt, this can't be fixed using the pure css approach like I initially thought.

    Maybe we should look into how it's done here: https://github.com/archfz/vh-sticky-table-header

Production build 0.71.5 2024