Skip to content

Commit 8639aaf

Browse files
committed
Add screen reader accessibility note to ElementInternals.labels
1 parent d9ed0d5 commit 8639aaf

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • files/en-us/web/api/elementinternals/labels

files/en-us/web/api/elementinternals/labels/index.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ let element = document.getElementById("custom-checkbox");
3131
console.log(element.internals_.label);
3232
```
3333

34+
## Accessibility
35+
36+
While the `labels` property returns the label elements associated with a custom element, screen reader support for these labels varies by browser. In most browsers, the label is announced when the custom element receives focus. However, Safari does not reliably narrate labels associated via `ElementInternals` for form-associated custom elements (see [WebKit bug 259124](https://bugs.webkit.org/show_bug.cgi?id=259124)).
37+
38+
For robust screen reader support across browsers, consider supplementing `ElementInternals` label association with ARIA attributes such as [`aria-labelledby`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-labelledby) or [`aria-label`](/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-label).
39+
3440
## Specifications
3541

3642
{{Specifications}}

0 commit comments

Comments
 (0)