Publish a mod_articles_category module that shows an article starting with a hyperlinked image, i.e.
<p><a href="alink.html"><img src="animage.png" alt="foo" width="600" height="300"></a></p>
<p>Some text...</p>
The image will be removed as well as the hyperlink that has become empty, i.e.
<p class="mod-articles-category-introtext">Some text...</p>
Only the image is removed, the hyperlink is still there, hence resulting in an accessibility error (WCAG 2.4.4 success criteria: Link Purpose), i.e.
<p class="mod-articles-category-introtext"><a href="alink.html"></a>Some text...</p>
in Joomla3 /modules/mod_articles_category/helper.php and
in Joomla4 /modules/mod_articles_category/src/Helper/ArticlesCategoryHelper.php
the function
public static function _cleanIntrotext($introtext)
{
$introtext = str_replace(array('<p>','</p>'), ' ', $introtext);
$introtext = strip_tags($introtext, '<a><em><strong>');
$introtext = trim($introtext);
return $introtext;
}
which is responsible of stripping the img tags, can be modified appending something like this
$introtext = preg_replace("/<a[^>]*><\\/a[^>]*>/", '', $introtext);
removing all empty hyperlinks
Title |
|
So funny that you say it is creating an accessibility problem when the original is even worse
Is it really expected that the linked image is removed from the article?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30564.
Well, looking at the _cleanIntrotext function (PHP strip_tags) I guess this is the intention. You can think about adding another display option, like "Introtext limit", to specify whether or not to show the images in the introtext.
But anyway, this won't change the behaviour of the suggested update because hyperlinks containing images won't be removed, they're not empty.
So funny that you say it is creating an accessibility problem when the original is even worse
I've tested both the original and the actual result with WAVE and AChecker for WCAG 2.0 compliance... what am I missing?
Labels |
Added:
No Code Attached Yet
a11y
Removed: ? |
Labels |
Added:
bug
|
Is it really expected that the linked image is removed from the article?
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/30564.