Problem/Motivation
Item IDs and classes are being generated directly from the item title in some scenarios.
That leads to inconsistent values that makes unpredictable the HTML markup of the navigation bar.
Steps to reproduce
Install a fresh Umami site and enable Navigation module
Go to the home page and confirm that Shortcuts item has a star icon (Class is .toolbar-button--shortcuts)
Go to the Spanish homepage https://mysite.example/es
Confirm that Shortcuts icon is broken (Class is .toolbar-button--atajos)
It happens not only in this menu item, but this is the most visible situation. Other menu items are being altered as well by the language switch.
Proposed resolution
Find a way to have consistent navigation items properties across the different languages in multilingual sites
Remaining tasks
Fix issue
Add tests
User interface changes
None
API changes
None
Data model changes
Issue fork navigation-3415455
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
plopescPostponing on #3415311: Decouple from Toolbar module because presumably will be necessary to make changes on the tree manipulators.
Comment #3
akhil babuShortcut icon will also break if the title of the 'Shortcut' block is modified. This happens because ShortcutsNavigationBlock uses the title of the block as the class name. When the title changes, the class name also changes, which breaks the style.
One solution is to use the 'id' of the block as the class name instead of the title. However, the navigation UI permits adding multiple blocks of the same type to the sidebar. If a user adds a second 'Shortcuts' block, the id of that block would be 'shortcuts_1,' and it will break the icon of the second block.
Comment #4
plopescComment #5
m4oliveiComment #6
m4oliveiMarking unblocked since #3415211: Error: Call to a member function replace() on null was merged.
Comment #7
m4oliveiComment #9
plopescComment #10
m4oliveiComment #11
plopescRequested changes addressed. I think it's ready for review.
Comment #12
m4oliveiThis looks great! Thanks @plopsec.
Comment #13
ckrinaThanks all for the work and help! Merged :D