Skip to content

docs(ByAltText): Add notes about support for custom elements #946

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

Merged
merged 3 commits into from
Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/queries/about.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ possible. With this in mind, we recommend this order of priority:
experience of interacting with these attributes varies greatly across
browsers and assistive technology.
1. `getByAltText`: If your element is one which supports `alt` text (`img`,
`area`, and `input`), then you can use this to find that element.
`area`, `input`, and any custom element), then you can use this to find that element.
1. `getByTitle`: The title attribute is not consistently read by
screenreaders, and is not visible by default for sighted users
1. **Test IDs**
Expand Down
2 changes: 1 addition & 1 deletion docs/queries/byalttext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ getByAltText(
```

This will return the element (normally an `<img>`) that has the given `alt`
text. Note that it only supports elements which accept an `alt` attribute:
text. Note that it only supports elements which accept an `alt` attribute or [custom elements](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements) (since we don't know if a custom element implements `alt` or not):
[`<img>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img),
[`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input),
and [`<area>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area)
Expand Down