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

Implement HasAriaLabel for html elements with a landmark role #17876

Closed
jcgueriaud1 opened this issue Oct 23, 2023 · 4 comments · Fixed by #18590
Closed

Implement HasAriaLabel for html elements with a landmark role #17876

jcgueriaud1 opened this issue Oct 23, 2023 · 4 comments · Fixed by #18590

Comments

@jcgueriaud1
Copy link
Contributor

Describe your motivation

For some html components it's recommended to use aria-label, aria-labelledby, and aria-describedbybut in Flow these components are not implementing the HasAriaLabel interface

Describe the solution you'd like

When it's recommended to use the aria-label, I would like to use the interface, when it's not recommended, we can use a Helper method or directly the Element API.

Describe alternatives you've considered

We could use directly the Element API.

Additional context

There is a link that explain the problem: https://www.tpgi.com/short-note-on-aria-label-aria-labelledby-and-aria-describedby/

So I wouldn't add the HasAriaLabel for a Div because it requires a role attribute.
But for the iframe, img, header, footer, main, nav, aside, section, and form, a, audio and video, input, select, button, and textarea.

Currently Main or Image implement the HasAriaLabel but it's not the case for an IFrame or Aside.

I don't know where the static methods could be added. At the same time we could add more aria-attr:
AriaHelper.setAriaLabel(myOddComponent, "This is odd");
and
AriaHelper.setAriaRole(myOddComponent, "complementary");
...

@jcgueriaud1
Copy link
Contributor Author

Link for the internal thread: https://vaadin.slack.com/archives/CSXCXSAMR/p1697807623026819

@jcgueriaud1
Copy link
Contributor Author

jcgueriaud1 commented Oct 24, 2023

I found the reason in the Flow code: https://www.w3.org/TR/using-aria/#label-support

For most assistive technology it's fine to use aria-label or aria-labelledby on the <nav>, and <main> elements but not on <footer>, <section>, <article>, or <header> .

At least, the IFrame should implement the HasAriaLabel according to the 2 links

@anezthes
Copy link
Contributor

anezthes commented Jan 26, 2024

section + aria-labelledby = <3

To name a section, provide it one of the following attributes (listed in order of preference, with the third option being the least optimal):

  • aria-labelledby
  • aria-label
  • title

https://www.scottohara.me/blog/2021/07/16/section.html

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.4.0.alpha3 and is also targeting the upcoming stable 24.4.0 version.

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