Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

role="auto" unnecessarily added to images. #9267

Open
4 tasks done
DennisSuitters opened this issue Feb 19, 2024 · 2 comments
Open
4 tasks done

role="auto" unnecessarily added to images. #9267

DennisSuitters opened this issue Feb 19, 2024 · 2 comments

Comments

@DennisSuitters
Copy link

Checklist

  • I've looked at the documentation to make sure the behavior isn't documented and expected.
  • I'm sure this is an issue with Leaflet, not with my app or other dependencies (Angular, Cordova, React, etc.).
  • I've searched through the current issues to make sure this hasn't been reported yet.
  • I agree to follow the Code of Conduct that this project adheres to.

Steps to reproduce

When running page speed insights, the following is reported as an accessibility error on the role attribute being set to auto:

<img src="[URL]" class="leaflet-marker-icon leaflet-zoom-animated leaflet-interactive" alt="Marker" tabindex="0" role="auto" style="margin-left: -12px; margin-top: -41px; width: 25px; height: 41px;">

The role attribute is not required in this instance, as the image is not masquerading as another element, making role redundant.

Expected behavior

That the generated markup via the script isn't unnecessarily adding attributes.

Current behavior

The role attribute does not need to be added to images, as role="image" or role="auto". The only time a role attribute is required is to tell the browser that the current element is a particular function, or if the current element is masquerading as another element, for e.g. a link being a button.

Minimal example reproducing the issue

No response

Environment

  • Leaflet version: 1.9
  • Browser (with version): Chrome (latest), but irrelevant in this case.
  • OS/Platform (with version): Linux
@Falke-Design
Copy link
Member

@Malvoz some thoughts from you?

@Malvoz
Copy link
Member

Malvoz commented Feb 20, 2024

For markers we're only setting:

icon.setAttribute('role', 'button');

See all instances of "role": https://github.com/search?q=repo%3ALeaflet%2FLeaflet%20role&type=code

@diemendesign auto is an invalid role value. Which URL did you analyze? Do you have a screenshot of the PageSpeed Insights results? Was a plugin in use?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants