question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: overriding aria attributes is not easy or straightforward

See original GitHub issue

Bug Report

Ionic version: [x] 4.x

Current behavior: Most Accessibility attributes, e.g. Aria-Label, Aria-LabeledBy, Role set on the Ion-Button does not work

Expected behavior: The Accessibility attributes should work on Ion-Button

Steps to reproduce: Create a simple Ion-Button with following attributes:

<ion-button role="link" aria-label="this is my data">
    View my data </ion-button>

This sample code should be read out as: “this is my data link”, but instead it reads out “View my data button”

Other information: Root Cause: Ion-Button has a shadow root: “button” . The attributes are not copied over to the button element. So the aria attributes not working.

Note: A workaround is to create a directive with MutationObserver to copy the aria attributes from Ion-Button to its shadow-root button.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
VincentCretecommented, Jun 5, 2020

@BingSZou, can-you show us an example of your workaround? We have the same problem.

0reactions
ionitron-bot[bot]commented, May 21, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Providing Accessible Names and Descriptions | APG - W3C
Several of the naming techniques highlight specific accessibility advantages of using HTML features instead of ARIA attributes. Rule 4: Avoid Browser Fallback.
Read more >
ARIA states and properties - Accessibility - MDN Web Docs
ARIA attributes enable modifying an element's states and properties as defined in the accessibility tree. Note: ARIA only modifies the ...
Read more >
Provide helpful error messages | Digital Accessibility​
Make it easy to locate the problem: Programmatically associate each error message with its corresponding form control using the aria-describedby attribute.
Read more >
What are these attributes: `aria-labelledby` and `aria-hidden`
aria -hidden (state) : Indicates that the element and all of its descendants are not visible or perceivable to any user as implemented...
Read more >
Decoding Label and Name for Accessibility - WebAIM
If an element uses ARIA labels ( aria-label or aria-labelledby ), this will override any other contender for accessible name, sometimes with ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found