Order of tabs changes

Created on 14 March 2023, over 1 year ago
Updated 27 April 2024, 7 months ago

I use Layout Builder for the layout of a content type.
In the layout page I have added a section of Tabs (five in total: Tab A, Tab B, Tab C, Tab D and Tab E)
Each tab contains a block.
The order of the tabs specified by moving the blocks and also looking at the row weights seems ok in the edit page: A, B, C,D,E
The problem is that on every single content page the order is different: !?:

A, D, E, C, B
D, E, A, B, C
B, D, A, C, E
E, A, B, D, C

I use Drupal 10.0.4 / Layout Builder Tabs 1.0.0

Any thought what could be the reason?

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain bolecha

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

Comments & Activities

  • Issue created by @bolecha
  • 🇨🇦Canada liquidcms

    We see the same issue with D9.5.

    Another site i do we have not seen this issue.

  • Status changed to Needs review over 1 year ago
  • 🇨🇦Canada liquidcms

    for us, we have a tab which is empty.. so it is showing up with a blank label. More importantly, the tab object doesn't have a #weight. This messes up the sort function used by this module.

    adding this at the top of their usort call in their performSort method fixes the issue:

          if (!isset($item1['#weight']) || !isset($item2['#weight'])) {
            return 1;
          }
    

    but adding some sort of visibility rule or fixing this module to not show empty tabs is likely a better solution

  • 🇪🇸Spain bolecha

    Thank you very much for the code!!
    At least it fixes my issue!

    • mandclu committed 2ac2e890 on 1.0.x
      Issue #3347917 by liquidcms, mandclu: Order of tabs changes
      
  • Status changed to Fixed 8 months ago
  • 🇨🇦Canada mandclu

    Thanks for reporting this, and for the suggested fix. Merged in.

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

Production build 0.71.5 2024