Problem/Motivation

Menus where a user role has no permission now display an arrow, even though the sub menu is still not available.


This is how the menu was before the Drupal 11 update which is correct.
Before update - correct


This is after the update:
After update - incorrect

Steps to reproduce

Login as an editor and view a menu where they have access to the main > submenu but not the next submenu
e.g. Structure > Taxonomy > Terms, but no permission for > Administer fields

CommentFileSizeAuthor
before_update.png6.04 KBbron.f
after_update.png3.16 KBbron.f

Comments

bron.f created an issue.

dydave’s picture

Thanks you very much Bron (@bron.f) for reporting this issue with a clear description and screenshot, it's very helpful! 🙏

I can confirm I was able to reproduce the problem with the steps described in the issue summary.

I have added the permission 'access taxonomy overview' to the 'Content editor' role, which reproduced the problem in the screenshot.

However, I was unable to reproduce the issue with other entity types, such as 'Block Content' or 'Media'. 😅
Assigning the permission 'administer media types' for example also seems to grant the permission to delete items and they will always have a child link to display: Delete

In short, it seems the menu links for the taxonomy terms wrongly receive the HTML class 'menu-item--expanded', for some reason.

But this should not be specific to the Admin Toolbar module and the behavior could probably be reproduced with other menu related modules using the Drupal core Toolbar, see:
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/modules/toolb...
This is where these classes are set, the Admin Toolbar module only adds some CSS styles...

Therefore, we would prefer if this issue could be addressed directly in Drupal core, rather than trying to implement some custom logic in the module to fix a wrong behavior, on which it relies.

Could you please try to see if you are able to reproduce this issue with any entity type other than 'Taxonomy'?
Could you please try to see if there would be any related issues in Drupal core? Maybe related to menu links or the toolbar?

Any additional information or context on the problem would help greatly better identifying a potential solution. 👍

Feel free to let us know if you have any questions or concerns on any aspects of this comment, or the module in general, we would surely try answering as soon as possible.
Thanks in advance!😊

bron.f’s picture

Thanks for your reply @dydave and for looking into the issue.

I tested with the other entity types and don't have any issues, it seems to only relate to Taxonomy as you said.

I ended up fixing the problem by reinstalling the deprecated module 'Administration links access filter' .

I found this related issue Restrict access to empty top level administration pages I guess it was meant to be integrated but still having issues.. will make a new bug in core. Thanks