Skip to content

Commit

Permalink
TODO: reword+fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Mar 9, 2023
1 parent 560d76a commit 3268d1a
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions docs/queries/byrole.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -165,47 +165,47 @@ the "πŸ‘Ž" by calling `getByRole('link', { current: false })`. To learn more abo
the current state see
[ARIA `aria-current`](https://www.w3.org/TR/wai-aria-1.2/#aria-current).

### `pressed`
### `disabled`

Buttons can have a pressed state. You can filter the returned elements by their
pressed state by setting `pressed: true` or `pressed: false`.
You can filter elements by their disabled state by setting `disabled: true` or
`disabled: false`.

For example in

```html
<body>
<section>
<button aria-pressed="true">πŸ‘</button>
<button aria-pressed="false">πŸ‘Ž</button>
<button disabled>Login</button>
<div role="alert" aria-disabled="false">Failed to login</button>
</section>
</body>
```

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).
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).

### `disabled`
### `pressed`

You can filter elements by their disabled state by setting `disabled: true` or
`disabled: false`.
Buttons can have a pressed state. You can filter the returned elements by their
pressed state by setting `pressed: true` or `pressed: false`.

For example in

```html
<body>
<section>
<button disabled>Login</button>
<div role="alert" aria-disabled="false">Failed to login</button>
<button aria-pressed="true">πŸ‘</button>
<button aria-pressed="false">πŸ‘Ž</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).
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).

### `suggest`

Expand Down

0 comments on commit 3268d1a

Please sign in to comment.