motion-dom 12.30.0 → 12.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +21 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +21 -9
- package/dist/es/gestures/press/utils/is-keyboard-accessible.mjs.map +1 -1
- package/dist/es/index.mjs +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/motion-dom.dev.js +21 -8
- package/dist/motion-dom.js +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -4282,7 +4282,7 @@ const isPrimaryPointer = (event) => {
|
|
|
4282
4282
|
}
|
|
4283
4283
|
};
|
|
4284
4284
|
|
|
4285
|
-
const
|
|
4285
|
+
const keyboardAccessibleElements = new Set([
|
|
4286
4286
|
"BUTTON",
|
|
4287
4287
|
"INPUT",
|
|
4288
4288
|
"SELECT",
|
|
@@ -4290,15 +4290,27 @@ const interactiveElements = new Set([
|
|
|
4290
4290
|
"A",
|
|
4291
4291
|
]);
|
|
4292
4292
|
/**
|
|
4293
|
-
* Checks if an element is
|
|
4294
|
-
*
|
|
4295
|
-
*
|
|
4296
|
-
* This specifically targets form controls, buttons, and links - not just any
|
|
4297
|
-
* element with tabIndex, since motion elements with tap handlers automatically
|
|
4298
|
-
* get tabIndex=0 for keyboard accessibility.
|
|
4293
|
+
* Checks if an element is natively keyboard accessible (focusable).
|
|
4294
|
+
* Used by the press gesture to determine if we need to add tabIndex.
|
|
4299
4295
|
*/
|
|
4300
4296
|
function isElementKeyboardAccessible(element) {
|
|
4301
|
-
return (
|
|
4297
|
+
return (keyboardAccessibleElements.has(element.tagName) ||
|
|
4298
|
+
element.isContentEditable === true);
|
|
4299
|
+
}
|
|
4300
|
+
const textInputElements = new Set(["INPUT", "SELECT", "TEXTAREA"]);
|
|
4301
|
+
/**
|
|
4302
|
+
* Checks if an element has text selection or direct interaction behavior
|
|
4303
|
+
* that should block drag gestures from starting.
|
|
4304
|
+
*
|
|
4305
|
+
* This specifically targets form controls where the user might want to select
|
|
4306
|
+
* text or interact with the control (e.g., sliders, dropdowns).
|
|
4307
|
+
*
|
|
4308
|
+
* Buttons and links are NOT included because they don't have click-and-move
|
|
4309
|
+
* actions of their own - they only respond to click events, so dragging
|
|
4310
|
+
* should still work when initiated from these elements.
|
|
4311
|
+
*/
|
|
4312
|
+
function isElementTextInput(element) {
|
|
4313
|
+
return (textInputElements.has(element.tagName) ||
|
|
4302
4314
|
element.isContentEditable === true);
|
|
4303
4315
|
}
|
|
4304
4316
|
|
|
@@ -9508,6 +9520,7 @@ exports.isDeltaZero = isDeltaZero;
|
|
|
9508
9520
|
exports.isDragActive = isDragActive;
|
|
9509
9521
|
exports.isDragging = isDragging;
|
|
9510
9522
|
exports.isElementKeyboardAccessible = isElementKeyboardAccessible;
|
|
9523
|
+
exports.isElementTextInput = isElementTextInput;
|
|
9511
9524
|
exports.isForcedMotionValue = isForcedMotionValue;
|
|
9512
9525
|
exports.isGenerator = isGenerator;
|
|
9513
9526
|
exports.isHTMLElement = isHTMLElement;
|