Skip to content

Commit

Permalink
fix(rule): make no-focusable-content not consult aria-hidden
Browse files Browse the repository at this point in the history
no-focusable content now consults only tabindex (for the 'not a reliable way of hiding interactive elements' messageKey check)
  • Loading branch information
dan-tripp committed Oct 14, 2021
1 parent e03f25f commit 4d7ed70
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/checks/keyboard/no-focusable-content-evaluate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function getFocusableDescendants(vNode) {

function usesUnreliableHidingStrategy(vNode) {
const tabIndex = parseInt(vNode.attr('tabindex'), 10);
return !isNaN(tabIndex) && tabIndex < 0 && vNode.attr('aria-hidden') === 'true';
return !isNaN(tabIndex) && tabIndex < 0;
}

function noFocusableContentEvaluate(node, options, virtualNode) {
Expand All @@ -35,7 +35,7 @@ function noFocusableContentEvaluate(node, options, virtualNode) {
const unreliableElems = focusableDescendants.filter(descendant => usesUnreliableHidingStrategy(descendant));
if(unreliableElems.length > 0) {
const ids = unreliableElems.map(node => node.attr('id'));
const msg = `Using aria-hidden and negative tabindex is not a reliable way of hiding interactive elements. `
const msg = `Using negative tabindex is not a reliable way of hiding interactive elements. `
+`Element id(s): [${ids.map(id => '"'+id+'"')}].`;
this.data({messageKey: 'info', values: msg});
}
Expand Down

0 comments on commit 4d7ed70

Please sign in to comment.