Cannot expand toolbar items referencing "<nolink>" or with options "_no_path"

Created on 15 February 2021, almost 4 years ago
Updated 13 June 2024, 7 months ago


Problem/Motivation

Cannot expand toolbar items referencing "<nolink>" or with options "_no_path". There is no arrow.
This only happens when the toolbar is on the left side.

With core itself cannot expand any if at the top (works as expected), and contrib module admin_toolbar works properly in that use case.

Version 10.1.x-dev shows a span without correct styling.

Steps to reproduce

  1. Install a clean version of Drupal 10.1.x-dev
  2. Optional: Install and enable the Admin Toolbar contrib module
  3. Add a menu item to a menu rendered in toolbar on the first navigation level below the "Administration" link.
  4. Use <nolink> in the path field of the menu item created in the previous step and mark the link as expanded
  5. Add one or more sub-menu items under menu item created in the previous two steps
  6. Activate the "Vertical orientation" button on the toolbar (typically at the far right).
  7. The toolbar will now be rendered vertically, all menu items of the first level in one column
  8. The menu items with sub items have a blue dot with arrow down - by a click on this icon you can reach their sub menu items. This icon is missing for the menu item with <nolink>

Proposed resolution

Ensure it has the "arrow" for expanding as any other menu item.

Originally posted by user tobiberlin in a duplicate issue:
In toolbar.menu.js or toolbar.menu.es6.js I think the method initItems() should use a class as a selector instead of the a tag as there are menu items allowed without link.
---
Initialize items and their links by adding the target element on ititItems at core/modules/toolbar/js/toolbar.menu.js, line 104.

--$menu.find('li > a').wrap('<div class="toolbar-box">');
++$menu.find('li > a, li > span').wrap('<div class="toolbar-box">');

The CSS for span tag was appended with Class selector span[class*="toolbar-icon-menu-link-content:"] to avoid effects on other unrelated span tags underbutton tag.

Remaining tasks

User interface changes

API changes

Release notes snippet

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Toolbar 

Last updated about 14 hours ago

  • Maintained by
  • 🇫🇷France @nod_
Created by

🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

Live updates comments and jobs are added and updated live.
  • Usability

    Makes Drupal easier to use. Preferred over UX, D7UX, etc.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024