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

Add aria-label API to Grid #6749

Closed
10 tasks
rolfsmeds opened this issue Nov 7, 2023 · 4 comments · Fixed by vaadin/flow-components#6878
Closed
10 tasks

Add aria-label API to Grid #6749

rolfsmeds opened this issue Nov 7, 2023 · 4 comments · Fixed by vaadin/flow-components#6878
Assignees
Labels
a11y Accessibility issue enhancement New feature or request vaadin-grid vaadin-grid-pro

Comments

@rolfsmeds
Copy link
Contributor

What is the problem?

Setting an accessible name on a vaadin-grid would require it to be applied to the <table> element inside the component's shadow DOM. Thus, there is no non-hacky way to achieve this currently.

accessible-name/accessible-name-ref properties, as supported by certain other components, would be appropriate, and a HasAriaLabel implementation in the Flow component.

Browsers

  • Chrome
  • Firefox
  • Safari
  • Safari on iOS
  • Edge

Screen Readers

  • None
  • NVDA
  • JAWS
  • VoiceOver on MacOS
  • VoiceOver on iOS
@rolfsmeds rolfsmeds added enhancement New feature or request a11y Accessibility issue vaadin-grid-pro vaadin-grid labels Nov 7, 2023
@web-padawan
Copy link
Member

accessible-name-ref properties, as supported by certain other components, would be appropriate

I don't think we can use accessibleNameRef because the <table> element is in shadow root of the grid.

@jcgueriaud1
Copy link
Contributor

Yes, with aria-label directly on the table in the shadow dom it's working.
With aria-labelledby="otherid" on the table inside the shadow dom, it's not working.

@rolfsmeds
Copy link
Contributor Author

rolfsmeds commented Nov 7, 2023

I don't think we can use accessibleNameRef because the <table> element is in shadow root of the grid.

No, we can't, that was a brainfart. But an accesibe-name prop on the <vaadin-grid> root that sets an aria-label on the <table> will do just fine (while we wait for web standards solve this for us properly).

That did make me realize, however, that a built-in title element for vaadin-grid, as proposed as part of #986, would be even more valuable than I'd previously realized.

@jcgueriaud1
Copy link
Contributor

jcgueriaud1 commented Nov 14, 2023

On the Java side you can set the aria-label by doing this:

grid.getElement().executeJs("this.shadowRoot.querySelector('table').ariaLabel = $0", "My grid name");

@rolfsmeds rolfsmeds moved this to Under consideration in Roadmap Nov 13, 2024
@DiegoCardoso DiegoCardoso self-assigned this Nov 26, 2024
DiegoCardoso added a commit that referenced this issue Nov 26, 2024
Add 'accessibleName' property to Grid which is used to define the
`aria-label` property on the `<table>` inside the shadow root.

Part of #6749
@rolfsmeds rolfsmeds moved this from Under consideration to March 2025 (V24.7) in Roadmap Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Accessibility issue enhancement New feature or request vaadin-grid vaadin-grid-pro
Projects
Status: March 2025 (V24.7)
Development

Successfully merging a pull request may close this issue.

4 participants