microsoft / fast

The adaptive interface system for modern web experiences.
https://www.fast.design
Other
9.23k stars 589 forks source link

fix(tooltip): an attempt at fixing `aria-describedby` #6918

Closed olaf-k closed 2 months ago

olaf-k commented 6 months ago

Pull Request

πŸ“– Description

This is an attempt at fixing the following:

  1. updating the anchor's aria-describedby even when the attribute does not exist in the first place
  2. updating the anchor's aria-describedby when the tooltip is disconnected
  3. removing event handlers when the tooltip is disconnected
  4. making screen readers pick up aria-describedby

🎫 Issues

4 is a fix for #6442

πŸ‘©β€πŸ’» Reviewer Notes

1 to 3 are straightforward and should not pose any issue hopefully.

to "solve" 4, moving aria-describedby to the custom element itself and adding role="button" seems to make the tooltip's text content picked up by screen readers.

Caveat:

once you press Control-Option-Command-Slash as instructed, you are presented with a list of additional data:

Screenshot 2024-02-29 at 12 14 38

there is a Safari ticket that discusses the issue but nothing Fast can do at this point: it is a VO limitation.

βœ… Checklist

General

Component-specific

janechu commented 2 months ago

Closing this due to #6951. As mentioned by @chrisdholt this will have wide ranging effects I believe in how attributes are reflected on the host element from the template element, in the Fluent UI web components we are working on better accessibility solutions, since cross root aria is such an issue I believe our solution there is to have the developer put a <button> element into the default slot so that any aria attributes are exposed as part of the light DOM.