File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ getByRole(
24
24
selected?: boolean ,
25
25
checked?: boolean ,
26
26
pressed?: boolean ,
27
+ current?: boolean | string ,
27
28
expanded?: boolean ,
28
29
queryFallbacks?: boolean ,
29
30
level?: number ,
@@ -142,6 +143,27 @@ state and which elements can have this state see
142
143
> Checkboxes have a "mixed" state, which is considered neither checked nor
143
144
> unchecked (details [ here] ( https://www.w3.org/TR/html-aam-1.0/#details-id-56 ) ).
144
145
146
+ ### ` current `
147
+
148
+ You can filter the returned elements by their current state by setting
149
+ ` current: boolean | string ` .
150
+ Note that no ` aria-current ` attribute will match ` current: false ` since ` false ` is the default value for ` aria-current ` .
151
+
152
+ For example in
153
+
154
+ ``` html
155
+ <body >
156
+ <nav >
157
+ <a href =" current/page" aria-current =" true" >👍</a >
158
+ <a href =" another/page" >👎</a >
159
+ </nav >
160
+ </body >
161
+ ```
162
+
163
+ you can get the "👍" link by calling ` getByRole('link', { current: true }) ` and the "👎" by calling ` getByRole('link', { current: false }) ` .
164
+ To learn more about the current state see
165
+ [ ARIA ` aria-current ` ] ( https://www.w3.org/TR/wai-aria-1.2/#aria-current ) .
166
+
145
167
### ` pressed `
146
168
147
169
Buttons can have a pressed state. You can filter the returned elements by their
You can’t perform that action at this time.
0 commit comments