Skip to content

Commit 83dba7c

Browse files
author
Mike Lumetta
committed
Add condition that requires <a> and <area> elements to have an href to be interactive
1 parent 0619a70 commit 83dba7c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ function reset() {
1717
}
1818

1919
function isInteractiveElement(element) {
20-
const interactiveTags = ['A', 'AREA', 'BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
21-
return interactiveTags.includes(element.tagName) && !element.hasAttribute('disabled');
20+
const formTags = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
21+
const linkTags = ['A', 'AREA'];
22+
return (formTags.includes(element.tagName) && !element.hasAttribute('disabled'))
23+
|| (linkTags.includes(element.tagName) && element.hasAttribute('href'));
2224
}
2325

2426
function getElAndScroll() {

0 commit comments

Comments
 (0)