Skip to content

Commit de6aefd

Browse files
docs(ByAltText): Add notes about support for custom elements (#946)
Co-authored-by: Tim Deschryver <[email protected]>
1 parent 6033d46 commit de6aefd

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

docs/queries/about.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ possible. With this in mind, we recommend this order of priority:
124124
experience of interacting with these attributes varies greatly across
125125
browsers and assistive technology.
126126
1. `getByAltText`: If your element is one which supports `alt` text (`img`,
127-
`area`, and `input`), then you can use this to find that element.
127+
`area`, `input`, and any custom element), then you can use this to find that element.
128128
1. `getByTitle`: The title attribute is not consistently read by
129129
screenreaders, and is not visible by default for sighted users
130130
1. **Test IDs**

docs/queries/byalttext.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ getByAltText(
2323
```
2424

2525
This will return the element (normally an `<img>`) that has the given `alt`
26-
text. Note that it only supports elements which accept an `alt` attribute:
26+
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):
2727
[`<img>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img),
2828
[`<input>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input),
2929
and [`<area>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/area)

0 commit comments

Comments
 (0)