Skip to content

Commit

Permalink
style(rule): fix lint errors
Browse files Browse the repository at this point in the history
Errors were in parent commit.
  • Loading branch information
dan-tripp committed Oct 8, 2021
1 parent 71fb98f commit 22e288d
Showing 1 changed file with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import isFocusable from '../../commons/dom/is-focusable';
import { tokenList } from '../../core/utils';

function getFocusableDescendants(vNode) {
if (!vNode.children) {
Expand All @@ -10,7 +9,7 @@ function getFocusableDescendants(vNode) {
return [];
}

let retVal = [];
const retVal = [];
vNode.children.forEach(child => {
if(isFocusable(child)) {
retVal.push(child);
Expand All @@ -22,28 +21,27 @@ function getFocusableDescendants(vNode) {
}

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

function noFocusableContentForNestedInteractiveEvaluate(node, options, virtualNode) {
if (!virtualNode.children) {
return undefined;
}
try {
let focusableDescendants = getFocusableDescendants(virtualNode);
const focusableDescendants = getFocusableDescendants(virtualNode);
if(focusableDescendants.length > 0) {
let focusableDescendantsThatUseUnreliableHidingStrategy = focusableDescendants.filter(
const focusableDescendantsThatUseUnreliableHidingStrategy = focusableDescendants.filter(
descendant => usesUnreliableHidingStrategy(descendant));
if(focusableDescendantsThatUseUnreliableHidingStrategy.length > 0) {
let ids = focusableDescendantsThatUseUnreliableHidingStrategy.map(node => node.attr('id'));
let n = focusableDescendantsThatUseUnreliableHidingStrategy.length;
let msg = `Using aria-hidden and negative tabindex is not a reliable way of hiding interactive elements. `
+`Element ids: [${ids.map(id => '"'+id+'"')}].`;
const ids = focusableDescendantsThatUseUnreliableHidingStrategy.map(node => node.attr('id'));
const msg = `Using aria-hidden and negative tabindex is not a reliable way of hiding interactive elements. `
+`Element id(s): [${ids.map(id => '"'+id+'"')}].`;
this.data({messageKey: 'info', values: msg});
}
}
return focusableDescendants.length == 0;
return focusableDescendants.length === 0;
} catch (e) {
return undefined;
}
Expand Down

0 comments on commit 22e288d

Please sign in to comment.