Skip to content

Commit fd3f540

Browse files
committed
feat(queries): Add docs about byRole#hidden
1 parent b231391 commit fd3f540

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

docs/dom-testing-library/api-queries.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ getByRole(
533533
role: TextMatch,
534534
options?: {
535535
exact?: boolean = true,
536+
hidden?: boolean = false,
536537
normalizer?: NormalizerFn,
537538
}): HTMLElement
538539
```
@@ -544,6 +545,12 @@ attribute. The
544545
[W3C HTML recommendation](https://www.w3.org/TR/html5/index.html#contents) lists
545546
all HTML elements with their default aria roles.
546547

548+
If you set `hidden` to `true` elements that are normally excluded from the
549+
accessibility tree are considered for the query as well. The default behavior
550+
follows https://www.w3.org/TR/wai-aria-1.2/#tree_exclusion with the exception of
551+
`role="none"` and `role="presentation"` which are considered in the query in any
552+
case.
553+
547554
```html
548555
<div role="dialog">...</div>
549556
```

0 commit comments

Comments
 (0)