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

Form-Associated Custom Elements are not Associated to Labels #4085

Closed
1 task done
break-stuff opened this issue Jul 10, 2023 · 8 comments
Closed
1 task done

Form-Associated Custom Elements are not Associated to Labels #4085

break-stuff opened this issue Jul 10, 2023 · 8 comments
Labels
rule metadata Issues in the rule metadata code (lib/rules) rules Issue or false result from an axe-core rule standards Issues in the ARIA standards objects (lib/standards)

Comments

@break-stuff
Copy link

Product

axe Extension

Product Version

4.58.3

Latest Version

  • I have tested the issue with the latest version of the product

Issue Description

Expectation

When using the ElementInternals API, form-associated custom elements should be able to be referenced by <label> elements using the for attribute.

Actual

The extension cited a critical issue saying the element was missing a label.

How to Reproduce

Additional context

The source code for this can be found here - https://codepen.io/break-stuff/pen/qBQPGVb

@break-stuff break-stuff added the ungroomed Ticket needs a maintainer to prioritize and label label Jul 10, 2023
@github-actions github-actions bot added the extension Axe Firefox or Chrome extension issues label Jul 10, 2023
@straker
Copy link
Contributor

straker commented Jul 10, 2023

Thanks for the issue. I'm not sure the ElementInternals are working correctly for screen readers. Here's how different screen readers and browsers read the input when focused:

  • VoiceOver / Safari - "Edit text, blank"
  • JAWS / Chrome - "My Input, edit, type of text"
  • NVDA / Firefox - "Edit has autocomplete, blank"

Checking the internals.labels property and the label is indeed associated with the element according to the API, but it appears that screen readers haven't caught up to this approach yet. As such I think it is correct that axe-core fails these.

@straker straker removed extension Axe Firefox or Chrome extension issues ungroomed Ticket needs a maintainer to prioritize and label labels Jul 10, 2023
@break-stuff
Copy link
Author

break-stuff commented Jul 11, 2023

Oh, interesting. VoiceOver on Chrome and Firefox are working for me - "Edit text, blank, My Input, group".
MS Narrator also appears to read it.

@break-stuff
Copy link
Author

break-stuff commented Jul 11, 2023

I went ahead and filed bugs for both NVDA and Apple about the above issues.

@WilcoFiers
Copy link
Contributor

I think we're going to need to figure out a way to detect this and report a separate issue for it. Missing for labels is a big problem, I wouldn't want to pass this, but it would be useful if we explicitly stated this technique isn't broadly supported yet.

@WilcoFiers WilcoFiers added rules Issue or false result from an axe-core rule rule metadata Issues in the rule metadata code (lib/rules) standards Issues in the ARIA standards objects (lib/standards) labels Jul 17, 2023
@break-stuff
Copy link
Author

After doing some digging, it looks like in Safari it is a bug on their end. The element is not properly referencing the label.

@mrazzari
Copy link

mrazzari commented Apr 3, 2024

Oh, interesting. VoiceOver on Chrome and Firefox are working for me - "Edit text, blank, My Input, group". MS Narrator also appears to read it.

The VO + Chrome implementation isn't great either.

  • The "group" in your test is a smell. Only actual groups, like a fieldset, should be announced as groups.
  • Using arrow navigation (VO + Right Arrow) each field results in 3 stops:
    1. My input, group.
    2. Text edit, empty.
    3. End of, My input, group
    • Compare with a regular form field which is just 1 stop: My input, text edit.
  • If we disable grouping then the control name is not announced when using arrow navigation.

Other tests:

  • Narrator + Chrome: no label announced.
  • Narrator + Edge: like VO, announces the label OK, but also "group".

Seems like major red flags on poor or inconsistent support for this feature.

@Westbrook
Copy link

@break-stuff Looking at this, without Reference Targets, I'm not sure why you would think that this label would point to the <input>. The <input> is on the other side of the shadow boundary, and while you've form associated the <my-input> you haven't given it a role, so it can't be "labelled" in the accessibility tree.

If that's true, isn't this more a bug of false positivity in Chrome and Firefox?

If you add a role, it performs as expected across all three browsers with Voice Over, sorry I don't have access to other screen readers just right now: https://codepen.io/Westbrook/pen/xxobNBe

@break-stuff
Copy link
Author

I agree. I was a bit naive in my understanding of what ElementInternals actually did for custom elements. Reference targets would solve this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule metadata Issues in the rule metadata code (lib/rules) rules Issue or false result from an axe-core rule standards Issues in the ARIA standards objects (lib/standards)
Projects
None yet
Development

No branches or pull requests

5 participants