@y14e/roving-tabindex 2.2.0 → 2.2.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/README.md +5 -0
- package/dist/index.cjs +16 -4
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,7 @@ interface RovingTabIndexOptions {
|
|
|
42
42
|
navigationOnly?: boolean; // default: false
|
|
43
43
|
noMemory?: boolean; // default: false
|
|
44
44
|
noStart?: boolean; // default: false
|
|
45
|
+
noStopPropagation?: boolean; // default: false
|
|
45
46
|
selector?: string;
|
|
46
47
|
typeahead?: boolean; // default: false
|
|
47
48
|
wrap?: boolean; // default: false
|
|
@@ -60,6 +61,10 @@ If `true`, disables focus memory. Focus always starts from the first item.
|
|
|
60
61
|
|
|
61
62
|
If `true`, does not assign `tabindex="0"` to the first item during initialization.
|
|
62
63
|
|
|
64
|
+
### `noStopPropagation`
|
|
65
|
+
|
|
66
|
+
If `true`, keyboard navigation will not call `stopPropagation()`.
|
|
67
|
+
|
|
63
68
|
### `typeahead`
|
|
64
69
|
|
|
65
70
|
If `true`, enables character-based focus navigation. Typing a character moves focus to the next matching element.
|
package/dist/index.cjs
CHANGED
|
@@ -301,6 +301,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
301
301
|
navigationOnly = false,
|
|
302
302
|
noMemory = false,
|
|
303
303
|
noStart = false,
|
|
304
|
+
noStopPropagation = false,
|
|
304
305
|
selector,
|
|
305
306
|
typeahead = false,
|
|
306
307
|
wrap = false
|
|
@@ -321,6 +322,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
321
322
|
console.warn("Invalid noStart option. Fallback: false.");
|
|
322
323
|
noStart = false;
|
|
323
324
|
}
|
|
325
|
+
if (typeof noStopPropagation !== "boolean") {
|
|
326
|
+
console.warn("Invalid noStopPropagation option. Fallback: false.");
|
|
327
|
+
noStopPropagation = false;
|
|
328
|
+
}
|
|
324
329
|
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
325
330
|
console.warn(
|
|
326
331
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
@@ -335,7 +340,14 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
335
340
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
336
341
|
wrap = false;
|
|
337
342
|
}
|
|
338
|
-
const settings = {
|
|
343
|
+
const settings = {
|
|
344
|
+
navigationOnly,
|
|
345
|
+
noMemory,
|
|
346
|
+
noStart,
|
|
347
|
+
noStopPropagation,
|
|
348
|
+
typeahead,
|
|
349
|
+
wrap
|
|
350
|
+
};
|
|
339
351
|
direction && Object.assign(settings, { direction });
|
|
340
352
|
selector && Object.assign(settings, { selector });
|
|
341
353
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -401,7 +413,7 @@ var RovingTabIndex = class {
|
|
|
401
413
|
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
402
414
|
return;
|
|
403
415
|
}
|
|
404
|
-
const { direction, typeahead, wrap } = this.#options;
|
|
416
|
+
const { direction, noStopPropagation, typeahead, wrap } = this.#options;
|
|
405
417
|
const isBoth = !direction;
|
|
406
418
|
const isHorizontal = direction === "horizontal";
|
|
407
419
|
if (![
|
|
@@ -423,7 +435,7 @@ var RovingTabIndex = class {
|
|
|
423
435
|
return;
|
|
424
436
|
}
|
|
425
437
|
event.preventDefault();
|
|
426
|
-
event.stopPropagation();
|
|
438
|
+
!noStopPropagation && event.stopPropagation();
|
|
427
439
|
const currentIndex = current.indexOf(active);
|
|
428
440
|
let rawIndex;
|
|
429
441
|
let newIndex = currentIndex;
|
|
@@ -541,7 +553,7 @@ function getActiveElement() {
|
|
|
541
553
|
* Lightweight roving tabindex utility with fully focus management.
|
|
542
554
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
543
555
|
*
|
|
544
|
-
* @version 2.2.
|
|
556
|
+
* @version 2.2.1
|
|
545
557
|
* @author Yusuke Kamiyamane
|
|
546
558
|
* @license MIT
|
|
547
559
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Lightweight roving tabindex utility with fully focus management.
|
|
4
4
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
5
5
|
*
|
|
6
|
-
* @version 2.2.
|
|
6
|
+
* @version 2.2.1
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -14,6 +14,7 @@ interface RovingTabIndexOptions {
|
|
|
14
14
|
readonly navigationOnly?: boolean;
|
|
15
15
|
readonly noMemory?: boolean;
|
|
16
16
|
readonly noStart?: boolean;
|
|
17
|
+
readonly noStopPropagation?: boolean;
|
|
17
18
|
readonly selector?: string;
|
|
18
19
|
readonly typeahead?: boolean;
|
|
19
20
|
readonly wrap?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Lightweight roving tabindex utility with fully focus management.
|
|
4
4
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
5
5
|
*
|
|
6
|
-
* @version 2.2.
|
|
6
|
+
* @version 2.2.1
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -14,6 +14,7 @@ interface RovingTabIndexOptions {
|
|
|
14
14
|
readonly navigationOnly?: boolean;
|
|
15
15
|
readonly noMemory?: boolean;
|
|
16
16
|
readonly noStart?: boolean;
|
|
17
|
+
readonly noStopPropagation?: boolean;
|
|
17
18
|
readonly selector?: string;
|
|
18
19
|
readonly typeahead?: boolean;
|
|
19
20
|
readonly wrap?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -299,6 +299,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
299
299
|
navigationOnly = false,
|
|
300
300
|
noMemory = false,
|
|
301
301
|
noStart = false,
|
|
302
|
+
noStopPropagation = false,
|
|
302
303
|
selector,
|
|
303
304
|
typeahead = false,
|
|
304
305
|
wrap = false
|
|
@@ -319,6 +320,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
319
320
|
console.warn("Invalid noStart option. Fallback: false.");
|
|
320
321
|
noStart = false;
|
|
321
322
|
}
|
|
323
|
+
if (typeof noStopPropagation !== "boolean") {
|
|
324
|
+
console.warn("Invalid noStopPropagation option. Fallback: false.");
|
|
325
|
+
noStopPropagation = false;
|
|
326
|
+
}
|
|
322
327
|
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
323
328
|
console.warn(
|
|
324
329
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
@@ -333,7 +338,14 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
333
338
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
334
339
|
wrap = false;
|
|
335
340
|
}
|
|
336
|
-
const settings = {
|
|
341
|
+
const settings = {
|
|
342
|
+
navigationOnly,
|
|
343
|
+
noMemory,
|
|
344
|
+
noStart,
|
|
345
|
+
noStopPropagation,
|
|
346
|
+
typeahead,
|
|
347
|
+
wrap
|
|
348
|
+
};
|
|
337
349
|
direction && Object.assign(settings, { direction });
|
|
338
350
|
selector && Object.assign(settings, { selector });
|
|
339
351
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -399,7 +411,7 @@ var RovingTabIndex = class {
|
|
|
399
411
|
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
400
412
|
return;
|
|
401
413
|
}
|
|
402
|
-
const { direction, typeahead, wrap } = this.#options;
|
|
414
|
+
const { direction, noStopPropagation, typeahead, wrap } = this.#options;
|
|
403
415
|
const isBoth = !direction;
|
|
404
416
|
const isHorizontal = direction === "horizontal";
|
|
405
417
|
if (![
|
|
@@ -421,7 +433,7 @@ var RovingTabIndex = class {
|
|
|
421
433
|
return;
|
|
422
434
|
}
|
|
423
435
|
event.preventDefault();
|
|
424
|
-
event.stopPropagation();
|
|
436
|
+
!noStopPropagation && event.stopPropagation();
|
|
425
437
|
const currentIndex = current.indexOf(active);
|
|
426
438
|
let rawIndex;
|
|
427
439
|
let newIndex = currentIndex;
|
|
@@ -539,7 +551,7 @@ function getActiveElement() {
|
|
|
539
551
|
* Lightweight roving tabindex utility with fully focus management.
|
|
540
552
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
541
553
|
*
|
|
542
|
-
* @version 2.2.
|
|
554
|
+
* @version 2.2.1
|
|
543
555
|
* @author Yusuke Kamiyamane
|
|
544
556
|
* @license MIT
|
|
545
557
|
* @copyright Copyright (c) Yusuke Kamiyamane
|