Badge/icon markup appended to main menu. When title is escaped/displayed, the markup is also escaped.
The screenreader text should only contain the title and not the badge/icon too.
Go to Menu Dashboard
View page source
Search Main Menu
See markup escaped
<span class="sr-only">Main Menu (de-DE) &nbsp;<span class="badge badge-secondary">de-DE</span> - New Item</span>
<span class="sr-only">Main Menu <span class="home-image icon-featured" aria-hidden="true"></span><span class="sr-only">Default</span> - New Item</span>
Labels |
Added:
?
|
Good find.
Please test this .diff
diff --git a/administrator/modules/mod_submenu/Menu/Menu.php b/administrator/modules/mod_submenu/Menu/Menu.php
index 6373673..ffa74ba 100644
--- a/administrator/modules/mod_submenu/Menu/Menu.php
+++ b/administrator/modules/mod_submenu/Menu/Menu.php
@@ -182,5 +182,5 @@
}
- $item->title = $item->title . $iconImage;
+ $item->iconImage = $iconImage;
}
}
diff --git a/administrator/modules/mod_submenu/tmpl/default.php b/administrator/modules/mod_submenu/tmpl/default.php
index a551a1b..a82b1c7 100644
--- a/administrator/modules/mod_submenu/tmpl/default.php
+++ b/administrator/modules/mod_submenu/tmpl/default.php
@@ -40,5 +40,5 @@
<?php echo HTMLHelper::_('image', $image, $alt, 'class="' . $class . '"'); ?>
<?php endif; ?>
- <?php echo ($params->get('menu_text', 1)) ? Text::_($item->title) : ''; ?>
+ <?php echo ($params->get('menu_text', 1)) ? Text::_($item->title) . $item->iconImage : ''; ?>
<?php if ($item->ajaxbadge) : ?>
<span class="menu-badge">
@@ -58,5 +58,5 @@
{
$title = Text::_('MOD_MENU_QUICKTASK_NEW');
- $sronly = Text::_($item->title) . ' - ' . Text::_('MOD_MENU_QUICKTASK_NEW');
+ $sronly = Text::_($item->title) . ' - ' . $title;
}
I am not sure if the $item->title must be translated, it should be already in the respective language?
And what, if $params->get('menu-quicktask-title') is not empty?
And what, if $params->get('menu-quicktask-title') is not empty?
If $params->get('menu-quicktask-title') is not empty, $sronly is undefined and throws a notice. The sr-only text is empty.
yep, this should be taken care of in the future PR
Tested successfully.
thanks for testing. will make patch, correcting also the $sronly which has to go after the conditional.
Will also look at the translation stuff
Please test #27074
I am not sure if the $item->title must be translated, it should be already in the respective language?
In fact not. These are the titles of the Menus (menutype). They should normally be translatable if desired by using a title formatted for translation i.e. for example MY_OWN_MENUTYPE
but when I tested by adding a lang override it was not loaded, whether in the sidebar menu (set debug lang on and you will see the ??MY_OWN_MENUTYPE??
or the dashboard in our case here. Modifying the Menus Manager I could get it to be translated in the manager itself, but did not find the way to get it also translated in the menutypes list.
Basically if we really want these to be translatable we need more work.
Note: in 3.x when debug lang is on all menu types are presented as untranslated in the debug sub-page. So this is not a new issue.
Closing as we have a patch
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-11-15 09:37:51 |
Closed_By | ⇒ | infograf768 |
@Quy could you add a screen? I cannot find it in my source code. Is it on multilingual sites?