You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, it's assumed that the first role of each element is supported, so only the first role can be queried. If you need to query an element by any of its fallback roles instead, you can use `queryFallbacks: true`.
715
-
716
-
For example, `getByRole('switch')` would always match `<div role="switch checkbox" />` because it's the first role, while `getByRole('checkbox')` would not. However, `getByRole('checkbox', { queryFallbacks: true })` would enable all fallback roles and therefore match the same element.
717
-
718
-
> An element doesn't have multiple roles in a given environment. It has a single one. Multiple roles in the attribute are evaluated from left to right until the environment finds the first role it understands. This is useful when new roles get introduced and you want to start supporting those as well as older environments that don't understand that role (yet).
718
+
By default, it's assumed that the first role of each element is supported, so
719
+
only the first role can be queried. If you need to query an element by any of
720
+
its fallback roles instead, you can use `queryFallbacks: true`.
721
+
722
+
For example, `getByRole('switch')` would always match
723
+
`<div role="switch checkbox" />` because it's the first role, while
724
+
`getByRole('checkbox')` would not. However,
725
+
`getByRole('checkbox', { queryFallbacks: true })` would enable all fallback
726
+
roles and therefore match the same element.
727
+
728
+
> An element doesn't have multiple roles in a given environment. It has a single
729
+
> one. Multiple roles in the attribute are evaluated from left to right until
730
+
> the environment finds the first role it understands. This is useful when new
731
+
> roles get introduced and you want to start supporting those as well as older
732
+
> environments that don't understand that role (yet).
0 commit comments