@waveform-playlist/core 13.0.0-next.3 → 13.0.0-next.4
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/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1257,7 +1257,9 @@ declare function keyBelongsToFocusedControl(event: KeyboardEvent): boolean;
|
|
|
1257
1257
|
* Pure function, no framework dependency.
|
|
1258
1258
|
*
|
|
1259
1259
|
* Shortcuts do not fire for a key the focused control uses itself; see
|
|
1260
|
-
* `keyBelongsToFocusedControl`.
|
|
1260
|
+
* `keyBelongsToFocusedControl`. Nor for an Escape whose default something
|
|
1261
|
+
* other than a shortcut already prevented (a drag cancelled it): an Escape that
|
|
1262
|
+
* cancelled a drag does nothing else.
|
|
1261
1263
|
*/
|
|
1262
1264
|
declare function handleKeyboardEvent(event: KeyboardEvent, shortcuts: KeyboardShortcut[], enabled: boolean): void;
|
|
1263
1265
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1257,7 +1257,9 @@ declare function keyBelongsToFocusedControl(event: KeyboardEvent): boolean;
|
|
|
1257
1257
|
* Pure function, no framework dependency.
|
|
1258
1258
|
*
|
|
1259
1259
|
* Shortcuts do not fire for a key the focused control uses itself; see
|
|
1260
|
-
* `keyBelongsToFocusedControl`.
|
|
1260
|
+
* `keyBelongsToFocusedControl`. Nor for an Escape whose default something
|
|
1261
|
+
* other than a shortcut already prevented (a drag cancelled it): an Escape that
|
|
1262
|
+
* cancelled a drag does nothing else.
|
|
1261
1263
|
*/
|
|
1262
1264
|
declare function handleKeyboardEvent(event: KeyboardEvent, shortcuts: KeyboardShortcut[], enabled: boolean): void;
|
|
1263
1265
|
|
package/dist/index.js
CHANGED
|
@@ -1120,14 +1120,17 @@ function keyBelongsToFocusedControl(event) {
|
|
|
1120
1120
|
if (ownsAllKeys(focused)) return true;
|
|
1121
1121
|
return activates(focused, event.key);
|
|
1122
1122
|
}
|
|
1123
|
+
var preventedByShortcut = /* @__PURE__ */ new WeakSet();
|
|
1123
1124
|
function handleKeyboardEvent(event, shortcuts, enabled) {
|
|
1124
1125
|
if (!enabled) return;
|
|
1125
1126
|
if (event.repeat) return;
|
|
1127
|
+
if (event.key === "Escape" && event.defaultPrevented && !preventedByShortcut.has(event)) return;
|
|
1126
1128
|
if (keyBelongsToFocusedControl(event)) return;
|
|
1127
1129
|
const matchingShortcut = shortcuts.find((shortcut) => matchesKeyBinding(event, shortcut));
|
|
1128
1130
|
if (matchingShortcut) {
|
|
1129
1131
|
if (matchingShortcut.preventDefault !== false) {
|
|
1130
1132
|
event.preventDefault();
|
|
1133
|
+
preventedByShortcut.add(event);
|
|
1131
1134
|
}
|
|
1132
1135
|
matchingShortcut.action();
|
|
1133
1136
|
}
|