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(
2424 selected?: boolean ,
2525 checked?: boolean ,
2626 pressed?: boolean ,
27+ current?: boolean | string ,
2728 expanded?: boolean ,
2829 queryFallbacks?: boolean ,
2930 level?: number ,
@@ -142,6 +143,27 @@ state and which elements can have this state see
142143> Checkboxes have a "mixed" state, which is considered neither checked nor
143144> unchecked (details [ here] ( https://www.w3.org/TR/html-aam-1.0/#details-id-56 ) ).
144145
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+
145167### ` pressed `
146168
147169Buttons 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