joomla-cms
joomla-cms copied to clipboard
[4.4] Remove alt-text for menuItem with image and title
Pull Request for Issue # .
Summary of Changes
In the menu layouts menus can have an image followed by an text. Alt-text for images are generated equal to the menuitem title. If the menutype is a link, this is an a11y issue, in other cases it is useless.
This PR replaces the alt text by an empty alt-text for all menutypes.
Testing Instructions
Code inspect and sourcecode inspect. Or use a tool like IBM accessible audit in your browser and check your menus with images.
Actual result BEFORE applying this Pull Request
Expected result AFTER applying this Pull Request
Link to documentations
Please select:
-
[ ] Documentation link for docs.joomla.org:
-
x] No documentation changes for docs.joomla.org needed
-
[ ] Pull Request link for manual.joomla.org:
-
[x No documentation changes for manual.joomla.org needed
LGTM
When Display Menu Item Title is disabled, then won't it be an a11y issue without the alt text?
No, as there is the menu item text , but hidden for sighted users
<span class="visually-hidden">' . $item->title . '</span>'
But this is not the case as seen below:
<li class="nav-item item-101"><a href="/joomla-cms-4.3-dev/index.php/home" ><img src="/joomla-cms-4.3-dev/images/joomla_black.png" alt="" width="225" height="50" loading="lazy"></a></li>
Thank you for testing - will fix this asap
I have tested this item :white_check_mark: successfully on b63b61155931691165a235a3f97edaa351670417
Using axe DevTools the menu image was flagged as Alternative text of images should not be repeated as text. With the patch that flag disappeared.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40675.
This pull request has been automatically rebased to 4.4-dev.
So any news here? Still open. Btw you may add "width" & "height" attributes to this <img> as well.
So any news here? Still open. Btw you may add "width" & "height" attributes to this
<img>as well.
The attributes width and height are not required for an img element.
The preserve the required space on a html page one can also use aspect-ratio
@chmst can you fix the error "This branch is out-of-date with the base branch" by merging most resent branch 4.4-dev into it?
The attributes
widthandheightare not required for animgelement. The preserve the required space on a html page one can also use aspect-ratio
@hans2103 Many things are not required, but I want a 100 score on PageSpeed Insights. :)
@pl71 consider creating a jlayout image to render the image using a cdn like imagekit and serve the image with the correct width and height
Probably some day. But for one icon only...
This one here is not RTC, it has only one test.
Back to pending as it has only one test
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40675.
I have tested this item :white_check_mark: successfully on 87b1361184413f0ca7fdc90076f226ab15da7d69
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40675.
This pull request has been automatically rebased to 5.2-dev.
I have tested this item :white_check_mark: successfully on 731bba015deb0de3ed8f0b0e187b9a78fceed4ec
Works fine. It adds an empty ALT to the purely decorative menu item image
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40675.
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40675.