No Code Attached Yet a11y bug
avatar stefanoel
stefanoel
3 Sep 2020

Steps to reproduce the issue

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>

Expected result

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>

Actual result

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>

System information (as much as possible)

Additional comments

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

avatar stefanoel stefanoel - open - 3 Sep 2020
avatar joomla-cms-bot joomla-cms-bot - labeled - 3 Sep 2020
avatar stefanoel stefanoel - change - 3 Sep 2020
The description was changed
avatar stefanoel stefanoel - edited - 3 Sep 2020
avatar stefanoel stefanoel - change - 3 Sep 2020
The description was changed
avatar stefanoel stefanoel - edited - 3 Sep 2020
avatar stefanoel stefanoel - change - 3 Sep 2020
The description was changed
avatar stefanoel stefanoel - edited - 3 Sep 2020
avatar stefanoel stefanoel - change - 3 Sep 2020
Title
mod_articles_category output contains empty tags
mod_articles_category output contains empty hyperlinks
avatar stefanoel stefanoel - edited - 3 Sep 2020
avatar chmst
chmst - comment - 7 Sep 2020

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.

avatar brianteeman
brianteeman - comment - 7 Sep 2020

So funny that you say it is creating an accessibility problem when the original is even worse

avatar stefanoel
stefanoel - comment - 7 Sep 2020

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.

avatar stefanoel
stefanoel - comment - 7 Sep 2020

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? ? ?

avatar chmst chmst - change - 17 May 2022
Labels Added: No Code Attached Yet a11y
Removed: ?
avatar chmst chmst - labeled - 17 May 2022
avatar Hackwar Hackwar - change - 20 Feb 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 20 Feb 2023

Add a Comment

Login with GitHub to post a comment