From a8e91ec347003398ff9474310f061c9f268ec481 Mon Sep 17 00:00:00 2001 From: Dan Tripp Date: Wed, 13 Oct 2021 20:27:28 -0400 Subject: [PATCH] refactor(check): misc. renaming and refactoring --- lib/checks/keyboard/frame-focusable-content-evaluate.js | 4 ++-- lib/checks/keyboard/frame-focusable-content.json | 2 +- lib/checks/keyboard/no-focusable-content-evaluate.js | 4 ++-- lib/core/base/metadata-function-map.js | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/checks/keyboard/frame-focusable-content-evaluate.js b/lib/checks/keyboard/frame-focusable-content-evaluate.js index ecbc419892..0624167778 100644 --- a/lib/checks/keyboard/frame-focusable-content-evaluate.js +++ b/lib/checks/keyboard/frame-focusable-content-evaluate.js @@ -18,7 +18,7 @@ function focusableDescendants(vNode) { }); } -function noFocusableContentForFrameEvaluate(node, options, virtualNode) { +function frameFocusableContentEvaluate(node, options, virtualNode) { if (!virtualNode.children) { return undefined; } @@ -32,4 +32,4 @@ function noFocusableContentForFrameEvaluate(node, options, virtualNode) { } } -export default noFocusableContentForFrameEvaluate; +export default frameFocusableContentEvaluate; diff --git a/lib/checks/keyboard/frame-focusable-content.json b/lib/checks/keyboard/frame-focusable-content.json index 274ffac76e..6926a2ccf2 100644 --- a/lib/checks/keyboard/frame-focusable-content.json +++ b/lib/checks/keyboard/frame-focusable-content.json @@ -1,6 +1,6 @@ { "id": "frame-focusable-content", - "evaluate": "no-focusable-content-for-frame-evaluate", + "evaluate": "frame-focusable-content-evaluate", "metadata": { "impact": "serious", "messages": { diff --git a/lib/checks/keyboard/no-focusable-content-evaluate.js b/lib/checks/keyboard/no-focusable-content-evaluate.js index 043dbfdf9f..907e32ee29 100644 --- a/lib/checks/keyboard/no-focusable-content-evaluate.js +++ b/lib/checks/keyboard/no-focusable-content-evaluate.js @@ -14,7 +14,7 @@ function getFocusableDescendants(vNode) { if(isFocusable(child)) { retVal.push(child); } else { - getFocusableDescendants(child).forEach(descendantOfChild => retVal.push(descendantOfChild)); + retVal.push(...getFocusableDescendants(child)); } }); return retVal; @@ -32,7 +32,7 @@ function noFocusableContentEvaluate(node, options, virtualNode) { try { const focusableDescendants = getFocusableDescendants(virtualNode); if(focusableDescendants.length > 0) { - const notHiddenElements = focusableDescendants.filter(descendant => usesUnreliableHidingStrategy(descendant)); + const notHiddenElements = focusableDescendants.filter(usesUnreliableHidingStrategy); if(notHiddenElements.length > 0) { this.data({ messageKey: 'notHidden' }); this.relatedNodes(notHiddenElements); diff --git a/lib/core/base/metadata-function-map.js b/lib/core/base/metadata-function-map.js index 9728debe69..362d57c362 100644 --- a/lib/core/base/metadata-function-map.js +++ b/lib/core/base/metadata-function-map.js @@ -96,7 +96,7 @@ import focusableModalOpenEvaluate from '../../checks/keyboard/focusable-modal-op import focusableNoNameEvaluate from '../../checks/keyboard/focusable-no-name-evaluate'; import focusableNotTabbableEvaluate from '../../checks/keyboard/focusable-not-tabbable-evaluate'; import landmarkIsTopLevelEvaluate from '../../checks/keyboard/landmark-is-top-level-evaluate'; -import noFocusableContentForFrameEvaluate from '../../checks/keyboard/frame-focusable-content-evaluate'; +import frameFocusableContentEvaluate from '../../checks/keyboard/frame-focusable-content-evaluate'; import noFocusableContentEvaluate from '../../checks/keyboard/no-focusable-content-evaluate'; import tabindexEvaluate from '../../checks/keyboard/tabindex-evaluate'; @@ -274,7 +274,7 @@ const metadataFunctionMap = { 'focusable-no-name-evaluate': focusableNoNameEvaluate, 'focusable-not-tabbable-evaluate': focusableNotTabbableEvaluate, 'landmark-is-top-level-evaluate': landmarkIsTopLevelEvaluate, - 'no-focusable-content-for-frame-evaluate': noFocusableContentForFrameEvaluate, + 'frame-focusable-content-evaluate': frameFocusableContentEvaluate, 'no-focusable-content-evaluate': noFocusableContentEvaluate, 'tabindex-evaluate': tabindexEvaluate,