Skip to content

Commit

Permalink
feat(ByRole): Allow filter by disabled state
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Mar 9, 2023
1 parent 96380af commit 560d76a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docs/queries/byrole.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ getByRole(
pressed?: boolean,
suggest?: boolean,
current?: boolean | string,
disabled?: boolean,
expanded?: boolean,
queryFallbacks?: boolean,
level?: number,
Expand Down Expand Up @@ -184,6 +185,28 @@ you can get the "👍" button by calling `getByRole('button', { pressed: true })
To learn more about the pressed state see
[ARIA `aria-pressed`](https://www.w3.org/TR/wai-aria-1.2/#aria-pressed).

### `disabled`

You can filter elements by their disabled state by setting `disabled: true` or
`disabled: false`.

For example in

```html
<body>
<section>
<button disabled>Login</button>
<div role="alert" aria-disabled="false">Failed to login</button>
</section>
</body>
```

you can get the "Login" button by calling
`getByRole('button', { disabled: true })`. To learn more about the disabled
state see
[ARIA `aria-disabled`](https://www.w3.org/TR/wai-aria-1.2/#aria-pressed) and
[MDN `disabled` attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled).

### `suggest`

You can disable the ability to
Expand Down

0 comments on commit 560d76a

Please sign in to comment.