?
avatar Quy
Quy
13 Nov 2019

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.

@chmst

Steps to reproduce the issue

Go to Menu Dashboard
View page source
Search Main Menu
See markup escaped

Actual result

<span class="sr-only">Main Menu (de-DE) &amp;nbsp;&lt;span class=&quot;badge badge-secondary&quot;&gt;de-DE&lt;/span&gt; - New Item</span>

<span class="sr-only">Main Menu &lt;span class=&quot;home-image icon-featured&quot; aria-hidden=&quot;true&quot;&gt;&lt;/span&gt;&lt;span class=&quot;sr-only&quot;&gt;Default&lt;/span&gt; - New Item</span>
avatar Quy Quy - open - 13 Nov 2019
avatar joomla-cms-bot joomla-cms-bot - change - 13 Nov 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 13 Nov 2019
avatar Quy Quy - change - 13 Nov 2019
The description was changed
avatar Quy Quy - edited - 13 Nov 2019
avatar chmst
chmst - comment - 13 Nov 2019

@Quy could you add a screen? I cannot find it in my source code. Is it on multilingual sites?

avatar Quy
Quy - comment - 13 Nov 2019

Clean install with no sample data. It happens on both.

27068

avatar Quy Quy - change - 13 Nov 2019
The description was changed
avatar Quy Quy - edited - 13 Nov 2019
avatar infograf768
infograf768 - comment - 14 Nov 2019

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;
 									}
 


avatar chmst
chmst - comment - 14 Nov 2019

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?

avatar infograf768
infograf768 - comment - 14 Nov 2019

@chmst
Your questions are unrelated to this issue. Please test the code.
Will look at the translation issues later.

avatar chmst
chmst - comment - 14 Nov 2019

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.

avatar infograf768
infograf768 - comment - 14 Nov 2019

yep, this should be taken care of in the future PR

avatar Quy
Quy - comment - 14 Nov 2019

Tested successfully. ?

avatar infograf768
infograf768 - comment - 14 Nov 2019

thanks for testing. will make patch, correcting also the $sronly which has to go after the conditional.
Will also look at the translation stuff

avatar infograf768
infograf768 - comment - 15 Nov 2019

Please test #27074

@chmst

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.

avatar infograf768
infograf768 - comment - 15 Nov 2019

Closing as we have a patch

avatar infograf768 infograf768 - change - 15 Nov 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-11-15 09:37:51
Closed_By infograf768
avatar infograf768 infograf768 - close - 15 Nov 2019

Add a Comment

Login with GitHub to post a comment