Skip to content

[6.2] Issue #46743 Fix: Add alt text and dimensions to Languages module images - #46792

Closed
chaitali-tekdi wants to merge 2 commits into
joomla:6.2-devfrom
chaitali-tekdi:Issue#46743
Closed

[6.2] Issue #46743 Fix: Add alt text and dimensions to Languages module images#46792
chaitali-tekdi wants to merge 2 commits into
joomla:6.2-devfrom
chaitali-tekdi:Issue#46743

Conversation

@chaitali-tekdi

@chaitali-tekdi chaitali-tekdi commented Jan 31, 2026

Copy link
Copy Markdown

Pull Request for Issue #46743 .

Issue Summary

The Languages module (mod_languages) was rendering language flag images without required accessibility attributes.

What was wrong earlier

tags were missing:

alt attribute (accessibility issue)

width and height attributes (performance / PageSpeed issue)

Even when the full_name parameter was enabled, the alt text was either:

empty, or

not rendered at all

This caused:

PageSpeed Insights warnings

Accessibility (WCAG) violations

Layout shift risk due to missing image dimensions

Example of incorrect output:


What has been fixed

Added proper alt text using the native language title

Added title, width, and height attributes to the image output

Ensured accessibility compliance and better performance by default

No override is required anymore to fix PageSpeed or accessibility errors

Updated code implementation

image . '.gif', $language->title_native, [ 'title' => $language->title_native, 'width' => '18', 'height' => '12' ], true ); ?>

Result

Expected output is now correctly rendered as:

English

  1. Better accessibility
  2. No PageSpeed errors
  3. Correct default behavior in core module

@Pranita-Zalli

Copy link
Copy Markdown

I have tested this item ✅ successfully on 700e7f9

I have tested this item ✅ successfully on 5.4-dev


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46792.

@RickR2H

RickR2H commented Jan 31, 2026

Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on 700e7f9

Not the most charming solution but good for now I guess.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46792.

@RickR2H

RickR2H commented Jan 31, 2026

Copy link
Copy Markdown
Member

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46792.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jan 31, 2026
@brianteeman

Copy link
Copy Markdown
Contributor

Sorry but this PR is completely wrong. In the dropdown mode of the language selector the flags are purely decorative and the current code is correct. Adding an alt attribute serves no purpose and should not be used on decorative images. Additionally setting a title on the image so that the language name is displayed on hover serves no purpose as the language name is displayed already.

Please remove the RTC as it should not be merged in its current form

@tecpromotion tecpromotion added PR-5.4-dev and removed RTC This Pull Request is Ready To Commit labels Jan 31, 2026
@richard67 richard67 added the Updates Requested Indicates that this pull request needs an update from the author and should not be tested. label Feb 1, 2026
@muhme

muhme commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

@chmst Could you clarify the intention of this PR? Is it meant to fix a bug, introduce a new feature, or is it possibly not really needed?

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Feb 10, 2026
@brianteeman

Copy link
Copy Markdown
Contributor

@chmst Could you clarify the intention of this PR? Is it meant to fix a bug, introduce a new feature, or is it possibly not really needed?

it is not that its not needed it is simply WRONG!!!

@brianteeman

Copy link
Copy Markdown
Contributor

Please remove the RTC status (again) this should NEVER be merged

@richard67 richard67 removed RTC This Pull Request is Ready To Commit Updates Requested Indicates that this pull request needs an update from the author and should not be tested. PR-5.4-dev labels Feb 10, 2026
@richard67

Copy link
Copy Markdown
Member

Back to pending. Decorative images shall not have an alt text.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46792.

@richard67 richard67 added Updates Requested Indicates that this pull request needs an update from the author and should not be tested. PR-5.4-dev labels Feb 10, 2026
@richard67

Copy link
Copy Markdown
Member

P.S.: Find all changes to be made in this comment above:

In the dropdown mode of the language selector the flags are purely decorative and the current code is correct. Adding an alt attribute serves no purpose and should not be used on decorative images. Additionally setting a title on the image so that the language name is displayed on hover serves no purpose as the language name is displayed already.

@richard67

Copy link
Copy Markdown
Member

So at the end it seems that only the width and height attributes are useful.

@richard67
richard67 changed the base branch from 5.4-dev to 6.1-dev February 10, 2026 19:29
@richard67
richard67 requested a review from laoneo as a code owner February 10, 2026 19:29
@richard67
richard67 changed the base branch from 6.1-dev to 5.4-dev February 10, 2026 19:29
@richard67

richard67 commented Feb 10, 2026

Copy link
Copy Markdown
Member

Finally, if this PR is corrected so that only adding the image height and width attributes is remaining, it is not a bug fix but an enhancement, so it should be rebased to 6.1-dev. We will do that as soon as appropriate in the next days. See also here for the rules for choosing the base branch: https://github.com/joomla/joomla-cms?tab=readme-ov-file#which-branch-should-my-pull-request-target

@richard67 richard67 added the RMDQ ReleaseManagerDecisionQueue label Feb 10, 2026
@richard67
richard67 removed request for chmst and laoneo February 10, 2026 19:36
@brianteeman

Copy link
Copy Markdown
Contributor

So at the end it seems that only the width and height attributes are useful.

Even that is debatable. The purpose of specifying the size is so that the browser can reserve a fixed space for the image while it is being loaded to prevent layout shifts. This is useful for large images. For such tiny images it is doubtful that any layout shift could ever be measured.

Just close this pr and if someone wants to add the dimensions then they can do that to the correct branch

@HLeithner
HLeithner changed the base branch from 5.4-dev to 6.2-dev March 17, 2026 09:08
@HLeithner

Copy link
Copy Markdown
Member

This pull request has been automatically rebased to 6.2-dev.

@HLeithner HLeithner changed the title Issue #46743 Fix: Add alt text and dimensions to Languages module images [6.2] Issue #46743 Fix: Add alt text and dimensions to Languages module images Mar 17, 2026
@muhme muhme removed the PR-5.4-dev label Mar 17, 2026
@MacJoom

MacJoom commented Aug 3, 2026

Copy link
Copy Markdown
Member

Thanks for the PR @chaitali-tekdi, and sorry it didn't work out.

In dropdown mode the flag is always followed by the language name or SEF code, so it's decorative — alt="" is correct as it stands, and adding the name makes screen readers announce it twice. Same for title, which duplicates visible text.

The hardcoded 18×12 isn't safe either: en_nz.gif and kk_kz.gif are 18×9 and eu_es.gif is 18×10, so those would be stretched.

Closing this one, but thanks for taking the time to look at it — please do keep contributing.

@MacJoom MacJoom closed this Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature PR-6.2-dev RMDQ ReleaseManagerDecisionQueue Updates Requested Indicates that this pull request needs an update from the author and should not be tested.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants