From 08af138935c2298c8c7cbff683cc0ed9ff522dc5 Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Fri, 15 Dec 2017 17:22:37 +0100 Subject: [PATCH] chore: Fix merge issue with isFocusable --- lib/checks/navigation/region.js | 2 +- lib/checks/navigation/skip-link.js | 3 ++- lib/commons/dom/is-focusable.js | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/checks/navigation/region.js b/lib/checks/navigation/region.js index 0baf4eb749..8c5ebaf110 100644 --- a/lib/checks/navigation/region.js +++ b/lib/checks/navigation/region.js @@ -10,7 +10,7 @@ const implicitLandmarks = landmarkRoles function isSkipLink(n) { return firstLink && - axe.commons.dom.isFocusable(axe.commons.dom.getElementByReference(firstLink, 'href')) && + axe.commons.dom.getElementByReference(firstLink, 'href') && firstLink === n; } diff --git a/lib/checks/navigation/skip-link.js b/lib/checks/navigation/skip-link.js index 92eb8cf509..8d34d08580 100644 --- a/lib/checks/navigation/skip-link.js +++ b/lib/checks/navigation/skip-link.js @@ -1 +1,2 @@ -return axe.commons.dom.isFocusable(axe.commons.dom.getElementByReference(node, 'href')); +const target = axe.commons.dom.getElementByReference(node, 'href'); +return !!target && axe.commons.dom.isFocusable(target); diff --git a/lib/commons/dom/is-focusable.js b/lib/commons/dom/is-focusable.js index 1a6273e5f2..1c5f9fe88e 100644 --- a/lib/commons/dom/is-focusable.js +++ b/lib/commons/dom/is-focusable.js @@ -1,4 +1,4 @@ -/* global dom */ +/* global console, dom */ /* jshint maxcomplexity: 20 */ /** * Determines if an element is focusable @@ -11,7 +11,7 @@ dom.isFocusable = function (el) { 'use strict'; - + console.log(el); if (dom.isNativelyFocusable(el)) { return true; }