From 9ca5dde89a8285588db97b1e9a69213d9223b454 Mon Sep 17 00:00:00 2001
From: Steven Lambert <2433219+straker@users.noreply.github.com>
Date: Mon, 20 Jul 2020 10:24:52 -0600
Subject: [PATCH] tests: add test for link-name for serial nodes (#2404)
* tests: add test for link-name for serial nodes
* finish tests
---
.../keyboard/focusable-no-name-evaluate.js | 11 +-
lib/commons/aria/get-role.js | 2 +-
lib/commons/standards/implicit-html-roles.js | 2 +-
test/integration/virtual-rules/index.html | 1 +
test/integration/virtual-rules/link-name.js | 172 ++++++++++++++++++
5 files changed, 181 insertions(+), 7 deletions(-)
create mode 100644 test/integration/virtual-rules/link-name.js
diff --git a/lib/checks/keyboard/focusable-no-name-evaluate.js b/lib/checks/keyboard/focusable-no-name-evaluate.js
index 5da1dc08a8..eb8b2c014f 100644
--- a/lib/checks/keyboard/focusable-no-name-evaluate.js
+++ b/lib/checks/keyboard/focusable-no-name-evaluate.js
@@ -2,12 +2,13 @@ import { isFocusable } from '../../commons/dom';
import { accessibleTextVirtual } from '../../commons/text';
function focusableNoNameEvaluate(node, options, virtualNode) {
+ const tabIndex = virtualNode.attr('tabindex');
+ const inFocusOrder = isFocusable(virtualNode) && tabIndex > -1;
+ if (!inFocusOrder) {
+ return false;
+ }
+
try {
- const tabIndex = virtualNode.attr('tabindex');
- const inFocusOrder = isFocusable(virtualNode) && tabIndex > -1;
- if (!inFocusOrder) {
- return false;
- }
return !accessibleTextVirtual(virtualNode);
} catch (e) {
return undefined;
diff --git a/lib/commons/aria/get-role.js b/lib/commons/aria/get-role.js
index bc92469e8e..972d6805b6 100644
--- a/lib/commons/aria/get-role.js
+++ b/lib/commons/aria/get-role.js
@@ -106,7 +106,7 @@ function resolveImplicitRole(vNode, explicitRoleOptions) {
// See also: https://github.com/w3c/aria/issues/1270
function hasConflictResolution(vNode) {
const hasGlobalAria = getGlobalAriaAttrs().some(attr => vNode.hasAttr(attr));
- return hasGlobalAria || isFocusable(vNode.actualNode);
+ return hasGlobalAria || isFocusable(vNode);
}
/**
diff --git a/lib/commons/standards/implicit-html-roles.js b/lib/commons/standards/implicit-html-roles.js
index d759484e96..890e31afca 100644
--- a/lib/commons/standards/implicit-html-roles.js
+++ b/lib/commons/standards/implicit-html-roles.js
@@ -93,7 +93,7 @@ const implicitHtmlRoles = {
vNode.hasAttr(attr)
);
- return emptyAlt && !hasGlobalAria && !isFocusable(vNode.actualNode)
+ return emptyAlt && !hasGlobalAria && !isFocusable(vNode)
? 'presentation'
: 'img';
},
diff --git a/test/integration/virtual-rules/index.html b/test/integration/virtual-rules/index.html
index 39a3fd7043..c3b9722259 100644
--- a/test/integration/virtual-rules/index.html
+++ b/test/integration/virtual-rules/index.html
@@ -34,6 +34,7 @@
+