At present, generation of id values from menu titles in line 236 of yuimenu.module is as follows:
$output .= '<div id="'. rep_char($menu['visible'][$mid]['title']).'" class="yuimenu">
This can result in duplicate id values in markup and subsequent validation failure if there are menu items in different sections of the menu which have the same title (which Drupal does allow).
I would make a reccomendation but the only thing that comes to mind is some check and subsequent handling of this (i.e. testing for and appending "-a", "-b", etc in event of duplicate values) and that seems rough around the edges. I also don't need individual id values for each menu item in the project I'm currently working on, so it was easier to strip out the id generating bit altogether; obviously, though, this isn't a real fix. ...
Comments
Comment #1
mariuss commentedSame issue here, but it gets worse. If the title contains special characters, an ampersand for example, then they will end up in the ID, and the ID will be invalid (and as a result the whole page will fail validation).
Instead of using menu titles for IDs why not use the menu id, the $mid variable. This should be prefixed with something like "yui_menu_".
Comment #2
mariuss commentedForgot to mention that this still happens in 2.3, where str_replace was added around rep_char.
Comment #3
bakyildiz commentedThanks. Next version will create id with $mid variable and will loke like id="yui_menu_id_67".
Comment #4
bakyildiz commentedis it possible to test the version yuimenu 5.x-2.x-dev ?
Comment #5
bakyildiz commentedComment #6
mariuss commentedLooks good to me.
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.