Decide how to control 2 active urls

Created on 9 December 2023, about 1 year ago
Updated 5 April 2024, 9 months ago

Problem/Motivation

Currently when the current URL matches one of the links in the menu it sets the "active" state on that link (on 1st, 2nd and 3rd menu item level). But if it turns out the URL is used in 2 different menus (as in the screenshot) both links will be set as active, resulting with several menus or sub-menus opened.

Steps to reproduce

  1. Navigate to /admin/config/people/accounts
  2. Both the "Account settings" under Configuration in the Administration menu and "Settings" in the User menu are set to Active.

Note: this happens right now because the User menu is not printing the real menu and has a manually added wrong link. Either way, this is a situation that will happen because we'll be opening the door to site builders to create and add menus. So we'll need to solve this anyway.

Proposed resolution

Decide how we should control that cases.

โœจ Feature request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

๐Ÿ‡ท๐Ÿ‡ธSerbia finnsky

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

Merge Requests

Comments & Activities

  • Issue created by @finnsky
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona

    Good point. Basically because we might end up having 2 custom menus with the same URLS. And we need to set a pattern.

    I'd say the easier way should be the menu closer on the top should have more priority: it'd be faster to reach and to visually locate. An alternative would be to add weight to each menu, but imho that would add unnecessary complexity.

    I know this goes against removing the active state from Shortcuts that we worked on, but we'll work on changing a few things for that menu: we'll add the links directly as items in the menu.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona
  • ๐Ÿ‡ช๐Ÿ‡ธSpain ckrina Barcelona
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    Prashant.c โ†’ made their first commit to this issueโ€™s fork.

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

    One other scenario or bug I found related to multiple active links
    such as when a URL strings matches will multiple anchor links in the menu multiple links getting active for example in user menu

    href for View Profileis /user and href for Edit Profileis /user/1/edit. In this case both links highlighted.

    I have tried to fix it by making some tweaks, there might be other scenarios as well.

    Thanks!

  • Status changed to Needs work 12 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    Changing to NW as main issue regarding 2 menu active links still needs work as mentioned in #2 โœจ Decide how to control 2 active urls Active

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

    In my opinion, it's acceptable for multiple menu items to share the same link and display them as active. This is because, if we prioritize these links or don't highlight others as active, users and administrators may not be aware that there are multiple links with the same URL. Additionally, there could be intentional reasons for having multiple links with the same URL. As a result, this should not pose any harm, but further discussion or feedback is encouraged.

    Thank you.

  • Pipeline finished with Success
    10 months ago
    Total: 34s
    #116488
  • Status changed to Closed: works as designed 9 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States KeyboardCowboy Denver, CO, USA

    We're closing this issue as it works as designed. With the new Drawer designs this is no longer a UX issue. We can open a new issue if we find this to be a problem in future iterations.

  • Pipeline finished with Failed
    8 months ago
    Total: 66s
    #146490
  • Pipeline finished with Success
    8 months ago
    Total: 959s
    #151279
  • Pipeline finished with Failed
    7 months ago
    Total: 1086s
    #187599
  • Pipeline finished with Success
    7 months ago
    Total: 1360s
    #187641
Production build 0.71.5 2024