motion-dom
Advanced tools
Comparing version 11.16.0 to 11.16.1
@@ -380,2 +380,21 @@ 'use strict'; | ||
/** | ||
* Recursively traverse up the tree to check whether the provided child node | ||
* is the parent or a descendant of it. | ||
* | ||
* @param parent - Element to find | ||
* @param child - Element to test against parent | ||
*/ | ||
const isNodeOrChild = (parent, child) => { | ||
if (!child) { | ||
return false; | ||
} | ||
else if (parent === child) { | ||
return true; | ||
} | ||
else { | ||
return isNodeOrChild(parent, child.parentElement); | ||
} | ||
}; | ||
const isPrimaryPointer = (event) => { | ||
@@ -398,2 +417,13 @@ if (event.pointerType === "mouse") { | ||
const focusableElements = new Set([ | ||
"BUTTON", | ||
"INPUT", | ||
"SELECT", | ||
"TEXTAREA", | ||
"A", | ||
]); | ||
function isElementKeyboardAccessible(element) { | ||
return focusableElements.has(element.tagName) || element.tabIndex !== -1; | ||
} | ||
const isPressing = new WeakSet(); | ||
@@ -436,33 +466,3 @@ | ||
const focusableElements = new Set([ | ||
"BUTTON", | ||
"INPUT", | ||
"SELECT", | ||
"TEXTAREA", | ||
"A", | ||
]); | ||
function isElementKeyboardAccessible(element) { | ||
return focusableElements.has(element.tagName) || element.tabIndex !== -1; | ||
} | ||
/** | ||
* Recursively traverse up the tree to check whether the provided child node | ||
* is the parent or a descendant of it. | ||
* | ||
* @param parent - Element to find | ||
* @param child - Element to test against parent | ||
*/ | ||
const isNodeOrChild = (parent, child) => { | ||
if (!child) { | ||
return false; | ||
} | ||
else if (parent === child) { | ||
return true; | ||
} | ||
else { | ||
return isNodeOrChild(parent, child.parentElement); | ||
} | ||
}; | ||
/** | ||
* Filter out events that are not primary pointer events, or are triggering | ||
@@ -523,3 +523,4 @@ * while a Motion gesture is active. | ||
elements.forEach((element) => { | ||
if (!isElementKeyboardAccessible(element)) { | ||
if (!isElementKeyboardAccessible(element) && | ||
element.getAttribute("tabindex") === null) { | ||
element.tabIndex = 0; | ||
@@ -526,0 +527,0 @@ } |
{ | ||
"name": "motion-dom", | ||
"version": "11.16.0", | ||
"version": "11.16.1", | ||
"author": "Matt Perry", | ||
@@ -26,3 +26,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "0d6f15819d66d9e76f3b32bc79ceb001079da43e" | ||
"gitHead": "d0d281ab97fe3ceef4d582d8da622faab907998d" | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
97004
2527
0