One menu opening should close the others

Created on 20 November 2023, about 1 year ago
Updated 3 January 2024, about 1 year ago

Problem/Motivation

There has been a regression: when a menu or submenu is opening, it should close the others. The reason is because the amount of vertical space is limited and menus can be really long, forcing to big scrolls.

Proposed resolution

When a menu/submenu is opened, the others should close so you never en up with more that one of them opened.

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona

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

Merge Requests

Comments & Activities

  • Pipeline finished with Skipped
    over 1 year ago
    #16225
  • Issue created by @ckrina
  • First commit to issue fork.
  • First commit to issue fork.
  • Merge request !137Resolve #3402899 "One menu opening" โ†’ (Open) created by kostyashupenko
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡ธSerbia finnsky

    Maybe put this logic on sidebar level?

    I personally not really like this:

                if (prevOpened && prevOpened !== button) {
                  Drupal.behaviors.navigationProcessToolbarMenuTriggers.toggleButtonState(prevOpened, false);
                }
    

    We have this logic for popovers with CustomEvents:
    https://git.drupalcode.org/project/navigation/-/blob/1.x/js/sidebar.js?r...

    I know that we search buttons twice. But this is payment for simple structure.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona

    I just tested it and found something that should also be addressed: when you leave a submenu by opening another one (either clicking when opened, or hovering parent when the sidebar is collapsed) it should be reset. Meaning that every time that you open a submenu it should be in its initial stated (unless itโ€™s active).

  • ๐Ÿ‡ท๐Ÿ‡บRussia kostyashupenko Omsk

    I would add my remark regarding javascript in module - we have many javascript files with too splitted logic from my point of view. For example expanding/collapsing behavior - we have different classnames and data attributes for 1st level buttons and 2nd level buttons. But actually the main goal of these buttons is just to expand/collapse, so these elements should be unified in this term and expanding behavior should be written in one drupal behavior (which controls all these buttons no matter on which levels they are).

    I let @finnsky or other guys to complete this issue

  • ๐Ÿ‡ท๐Ÿ‡ธSerbia finnsky

    Re #8
    In fact second level button is just expand/collapse first level one is much complicated in terms of hover popover and tooltips. that why i splitted this js.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡ธSerbia finnsky

    Added imo simpler version. Please review!

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia kostyashupenko Omsk

    #7 ๐Ÿ› One menu opening should close the others Needs review not fixed.

    When you expanding new menu, all child els should be collapsed by default unless it's an active element (but not sure if we have to check if element is active or not). I'm thinking that by element is already active and all its tree is expanded. Means if user decided to collapse parent menu -> child should be collapsed aswell no matter if it's active element or not.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    It is concurred with #12 ๐Ÿ› One menu opening should close the others Needs review that in instances where the parent menu undergoes a collapse, the associated child menu items should likewise undergo a collapse, specifically if they are not currently in an active state.

  • Pipeline finished with Skipped
    about 1 year ago
    #60357
  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡ธSerbia finnsky

    So!

    In my point of view Component (Popover, Menu, Tooltip) only should control own state.
    And all common logic will stay on sidebar.js level.
    All communication between Navigation Components happens in one place via Custom Events bubbles.

    Please review!

  • Status changed to RTBC about 1 year ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona

    The code looks good to me, and I've manually tested and works great. Thanks all!

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    Looks good to me. Working as expected for Parent menus. I am assuming we will not collapse child menus when other one is expanded for example under "Configuration" menu.

  • ๐Ÿ‡ท๐Ÿ‡บRussia kostyashupenko Omsk

    kostyashupenko โ†’ changed the visibility of the branch close-all-when-one-opened-3402899 to hidden.

  • ๐Ÿ‡ท๐Ÿ‡บRussia kostyashupenko Omsk

    kostyashupenko โ†’ changed the visibility of the branch 3402899-one-menu-opening to hidden.

  • Status changed to Needs review about 1 year ago
  • ๐Ÿ‡ท๐Ÿ‡บRussia kostyashupenko Omsk

    The fastest option was to create new MR instead of doing hard rebases.
    MR 151 opened, and i moved manually all the changes from the previous MR 141. Previous MR worked perfectly and i wanted to merge it and change status to "Fixed", but since hard rebase / recreation of the new MR -> this issue needs review again

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    I examined it in the live preview, and it functioned correctly.

  • Status changed to Fixed about 1 year ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona

    Merged! Thanks all for the work on this!

  • Pipeline finished with Skipped
    about 1 year ago
    #69497
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • Pipeline finished with Success
    12 months ago
    #101482
  • Pipeline finished with Success
    12 months ago
    Total: 33s
    #101709
  • Pipeline finished with Success
    11 months ago
    Total: 167s
    #104463
  • Pipeline finished with Success
    11 months ago
    Total: 168s
    #104464
  • Pipeline finished with Success
    11 months ago
    Total: 257s
    #110444
  • Pipeline finished with Success
    11 months ago
    Total: 33s
    #110605
  • Pipeline finished with Success
    11 months ago
    Total: 166s
    #111084
  • Pipeline finished with Success
    11 months ago
    Total: 139s
    #111130
  • Pipeline finished with Success
    11 months ago
    Total: 33s
    #113948
  • Pipeline finished with Success
    11 months ago
    Total: 33s
    #113958
  • Pipeline finished with Success
    11 months ago
    Total: 34s
    #114637
  • Pipeline finished with Success
    11 months ago
    Total: 33s
    #114809
  • Pipeline finished with Failed
    11 months ago
    Total: 43s
    #114926
  • Pipeline finished with Failed
    11 months ago
    Total: 42s
    #114990
  • Pipeline finished with Success
    11 months ago
    #116387
  • Pipeline finished with Success
    11 months ago
    #116388
  • Pipeline finished with Success
    11 months ago
    Total: 45s
    #116392
  • Pipeline finished with Success
    11 months ago
    Total: 43s
    #116406
  • Pipeline finished with Success
    11 months ago
    Total: 44s
    #116411
  • Pipeline finished with Success
    11 months ago
    Total: 72s
    #116429
  • Pipeline finished with Success
    11 months ago
    Total: 73s
    #116452
  • Pipeline finished with Success
    11 months ago
    Total: 123s
    #116462
  • Pipeline finished with Success
    11 months ago
    Total: 34s
    #116463
  • Pipeline finished with Success
    11 months ago
    Total: 34s
    #116464
  • Pipeline finished with Success
    11 months ago
    Total: 34s
    #116557
  • Pipeline finished with Success
    11 months ago
    Total: 125s
    #116555
  • Pipeline finished with Success
    11 months ago
    #116559
  • Pipeline finished with Success
    11 months ago
    #116568
  • Pipeline finished with Success
    11 months ago
    Total: 78s
    #116575
  • Pipeline finished with Success
    11 months ago
    Total: 34s
    #116586
  • Pipeline finished with Success
    11 months ago
    Total: 51s
    #116590
  • Pipeline finished with Success
    11 months ago
    Total: 52s
    #116594
  • Pipeline finished with Success
    11 months ago
    Total: 57s
    #117152
  • Pipeline finished with Success
    11 months ago
    Total: 50s
    #117158
  • Pipeline finished with Canceled
    11 months ago
    Total: 821s
    #117448
  • Pipeline finished with Canceled
    11 months ago
    #117466
  • Pipeline finished with Canceled
    11 months ago
    Total: 528s
    #117469
  • Pipeline finished with Canceled
    11 months ago
    Total: 408s
    #117475
  • Pipeline finished with Canceled
    11 months ago
    Total: 797s
    #117479
  • Pipeline finished with Success
    11 months ago
    #117491
  • Pipeline finished with Success
    11 months ago
    Total: 51s
    #118117
  • Pipeline finished with Success
    11 months ago
    Total: 52s
    #118319
  • Pipeline finished with Success
    11 months ago
    Total: 520s
    #118320
  • Pipeline finished with Success
    11 months ago
    Total: 452s
    #118388
  • Pipeline finished with Success
    11 months ago
    Total: 174s
    #118403
  • Pipeline finished with Success
    11 months ago
    Total: 58850s
    #118405
  • Pipeline finished with Success
    11 months ago
    Total: 54s
    #118904
  • Pipeline finished with Success
    10 months ago
    Total: 134s
    #141094
  • Pipeline finished with Success
    10 months ago
    Total: 136s
    #141095
  • Pipeline finished with Success
    10 months ago
    Total: 199s
    #146325
  • Pipeline finished with Failed
    10 months ago
    Total: 1027s
    #150211
  • Pipeline finished with Failed
    10 months ago
    Total: 1080s
    #153161
  • Pipeline finished with Failed
    10 months ago
    #153331
  • Pipeline finished with Canceled
    10 months ago
    #153343
  • Pipeline finished with Failed
    10 months ago
    Total: 997s
    #153345
  • Pipeline finished with Failed
    10 months ago
    Total: 1105s
    #153374
  • Pipeline finished with Failed
    9 months ago
    #164294
  • Pipeline finished with Canceled
    9 months ago
    Total: 367s
    #164303
  • Pipeline finished with Failed
    9 months ago
    Total: 371s
    #164306
  • Pipeline finished with Failed
    9 months ago
    Total: 570s
    #164309
  • Pipeline finished with Success
    9 months ago
    Total: 832s
    #164344
  • Pipeline finished with Success
    9 months ago
    Total: 1053s
    #164347
  • Pipeline finished with Success
    9 months ago
    Total: 1255s
    #168754
  • Pipeline finished with Failed
    9 months ago
    Total: 1007s
    #174281
  • Pipeline finished with Canceled
    9 months ago
    Total: 82s
    #176694
  • Pipeline finished with Success
    9 months ago
    Total: 1052s
    #176695
  • Pipeline finished with Success
    9 months ago
    Total: 953s
    #176713
  • Pipeline finished with Success
    9 months ago
    Total: 1078s
    #177167
  • Pipeline finished with Failed
    8 months ago
    Total: 1188s
    #187050
  • Pipeline finished with Canceled
    8 months ago
    Total: 862s
    #187219
  • Pipeline finished with Canceled
    8 months ago
    Total: 476s
    #187237
  • Pipeline finished with Failed
    8 months ago
    Total: 1058s
    #187247
  • Pipeline finished with Success
    8 months ago
    Total: 1124s
    #187482
Production build 0.71.5 2024