Function
queryAllByRole
(
container,
role,
{
hidden = getConfig().defaultHidden,
name,
description,
queryFallbacks = false,
selected,
busy,
checked,
pressed,
current,
level,
expanded,
value: {
now: valueNow,
min: valueMin,
max: valueMax,
text: valueText,
} = {} as NonNullable<ByRoleOptions['value']>,
} = {},
)
Source from the content-addressed store, hash-verified
| 40 | import {buildQueries, getConfig, matches} from './all-utils' |
| 41 | |
| 42 | const queryAllByRole: AllByRole = ( |
| 43 | container, |
| 44 | role, |
| 45 | { |
| 46 | hidden = getConfig().defaultHidden, |
| 47 | name, |
| 48 | description, |
| 49 | queryFallbacks = false, |
| 50 | selected, |
| 51 | busy, |
| 52 | checked, |
| 53 | pressed, |
| 54 | current, |
| 55 | level, |
| 56 | expanded, |
| 57 | value: { |
| 58 | now: valueNow, |
| 59 | min: valueMin, |
| 60 | max: valueMax, |
| 61 | text: valueText, |
| 62 | } = {} as NonNullable<ByRoleOptions['value']>, |
| 63 | } = {}, |
| 64 | ) => { |
| 65 | checkContainerType(container) |
| 66 | |
| 67 | if (selected !== undefined) { |
| 68 | // guard against unknown roles |
| 69 | if ( |
| 70 | allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-selected'] === |
| 71 | undefined |
| 72 | ) { |
| 73 | throw new Error(`"aria-selected" is not supported on role "${role}".`) |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | if (busy !== undefined) { |
| 78 | // guard against unknown roles |
| 79 | if ( |
| 80 | allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-busy'] === |
| 81 | undefined |
| 82 | ) { |
| 83 | throw new Error(`"aria-busy" is not supported on role "${role}".`) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | if (checked !== undefined) { |
| 88 | // guard against unknown roles |
| 89 | if ( |
| 90 | allRoles.get(role as ARIARoleDefinitionKey)?.props['aria-checked'] === |
| 91 | undefined |
| 92 | ) { |
| 93 | throw new Error(`"aria-checked" is not supported on role "${role}".`) |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | if (pressed !== undefined) { |
| 98 | // guard against unknown roles |
| 99 | if ( |