Skip to content

Commit

Permalink
rely on getRole instead of adding hasGlobalAttr and focusable unecess…
Browse files Browse the repository at this point in the history
…arily
  • Loading branch information
gaiety-deque committed Apr 30, 2024
1 parent f914665 commit be633af
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions lib/checks/navigation/region-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ function findRegionlessElms(virtualNode, options) {
// - a landmark
// - a skiplink
// - hidden content
// - a presentation graphic
if (
getRole(virtualNode) === 'button' ||
isRegion(virtualNode, options) ||
Expand Down Expand Up @@ -79,7 +78,7 @@ function findRegionlessElms(virtualNode, options) {
} else if (
node !== document.body &&
dom.hasContent(node, /* noRecursion: */ true) &&
!isPresentational(node, virtualNode)
!isShallowlyHidden(virtualNode)
) {
return [virtualNode];

Expand All @@ -92,18 +91,6 @@ function findRegionlessElms(virtualNode, options) {
}
}

function isPresentational(node, virtualNode) {
return (
isShallowlyHidden(virtualNode) &&
!hasGlobalAriaAttr(virtualNode) &&
!dom.isFocusable(node)
);
}

function hasGlobalAriaAttr(virtualNode) {
return standards.getGlobalAriaAttrs().some(attr => virtualNode.hasAttr(attr));
}

function isShallowlyHidden(virtualNode) {
// The element itself is not visible to screen readers, but its descendants might be
return (
Expand Down

0 comments on commit be633af

Please sign in to comment.