Skip to content

Commit 4575c9d

Browse files
feat(ByRole): Allow filter by busy state (#1232)
* feat(ByRole): Allow filter by busy state * TODO: reword+fixup * Update docs/queries/byrole.mdx Co-authored-by: Tim Deschryver <[email protected]> --------- Co-authored-by: Tim Deschryver <[email protected]>
1 parent 0aa6f62 commit 4575c9d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/queries/byrole.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ getByRole(
2121
name?: TextMatch,
2222
description?: TextMatch,
2323
selected?: boolean,
24+
busy?: boolean,
2425
checked?: boolean,
2526
pressed?: boolean,
2627
suggest?: boolean,
@@ -115,6 +116,27 @@ you can get the "Native"-tab by calling `getByRole('tab', { selected: true })`.
115116
To learn more about the selected state and which elements can have this state
116117
see [ARIA `aria-selected`](https://www.w3.org/TR/wai-aria-1.2/#aria-selected).
117118

119+
### `busy`
120+
121+
You can filter the returned elements by their busy state by setting `busy: true`
122+
or `busy: false`.
123+
124+
For example in
125+
126+
```html
127+
<body>
128+
<section>
129+
<div role="alert" aria-busy="false">Login failed</div>
130+
<div role="alert" aria-busy="true">Error: Loading message...</div>
131+
</section>
132+
</body>
133+
```
134+
135+
you can get the "Login failed" alert by calling
136+
`getByRole('alert', { busy: false })`. To learn more about the busy state see
137+
[ARIA `aria-busy`](https://www.w3.org/TR/wai-aria-1.2/#aria-busy) and
138+
[MDN `aria-busy` attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-busy).
139+
118140
### `checked`
119141

120142
You can filter the returned elements by their checked state by setting

0 commit comments

Comments
 (0)