Skip to content

Commit 2866544

Browse files
kevin940726eps1lon
andauthored
feat: Prioritize accessible names check higher than inaccessibility check in byRole queries (#1068)
Co-authored-by: eps1lon <[email protected]>
1 parent b6b9b5b commit 2866544

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/queries/role.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,6 @@ function queryAllByRole(
153153
// don't care if aria attributes are unspecified
154154
return true
155155
})
156-
.filter(element => {
157-
return hidden === false
158-
? isInaccessible(element, {
159-
isSubtreeInaccessible: cachedIsSubtreeInaccessible,
160-
}) === false
161-
: true
162-
})
163156
.filter(element => {
164157
if (name === undefined) {
165158
// Don't care
@@ -176,6 +169,13 @@ function queryAllByRole(
176169
text => text,
177170
)
178171
})
172+
.filter(element => {
173+
return hidden === false
174+
? isInaccessible(element, {
175+
isSubtreeInaccessible: cachedIsSubtreeInaccessible,
176+
}) === false
177+
: true
178+
})
179179
}
180180

181181
function makeRoleSelector(role, exact, customNormalizer) {

0 commit comments

Comments
 (0)