@y14e/roving-tabindex 2.2.1 → 3.0.0
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 +4 -9
- package/dist/index.cjs +2 -9
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,14 +10,14 @@ npm i @y14e/roving-tabindex
|
|
|
10
10
|
|
|
11
11
|
```ts
|
|
12
12
|
// npm
|
|
13
|
-
import { createRovingTabIndex } from '@y14e/roving-tabindex@
|
|
13
|
+
import { createRovingTabIndex } from '@y14e/roving-tabindex@3.0.0';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@
|
|
16
|
+
import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@3.0.0';
|
|
17
17
|
// or
|
|
18
|
-
import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@
|
|
18
|
+
import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@3.0.0/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@
|
|
20
|
+
import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@3.0.0';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
|
@@ -42,7 +42,6 @@ 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
|
|
46
45
|
selector?: string;
|
|
47
46
|
typeahead?: boolean; // default: false
|
|
48
47
|
wrap?: boolean; // default: false
|
|
@@ -61,10 +60,6 @@ If `true`, disables focus memory. Focus always starts from the first item.
|
|
|
61
60
|
|
|
62
61
|
If `true`, does not assign `tabindex="0"` to the first item during initialization.
|
|
63
62
|
|
|
64
|
-
### `noStopPropagation`
|
|
65
|
-
|
|
66
|
-
If `true`, keyboard navigation will not call `stopPropagation()`.
|
|
67
|
-
|
|
68
63
|
### `typeahead`
|
|
69
64
|
|
|
70
65
|
If `true`, enables character-based focus navigation. Typing a character moves focus to the next matching element.
|
package/dist/index.cjs
CHANGED
|
@@ -301,7 +301,6 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
301
301
|
navigationOnly = false,
|
|
302
302
|
noMemory = false,
|
|
303
303
|
noStart = false,
|
|
304
|
-
noStopPropagation = false,
|
|
305
304
|
selector,
|
|
306
305
|
typeahead = false,
|
|
307
306
|
wrap = false
|
|
@@ -322,10 +321,6 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
322
321
|
console.warn("Invalid noStart option. Fallback: false.");
|
|
323
322
|
noStart = false;
|
|
324
323
|
}
|
|
325
|
-
if (typeof noStopPropagation !== "boolean") {
|
|
326
|
-
console.warn("Invalid noStopPropagation option. Fallback: false.");
|
|
327
|
-
noStopPropagation = false;
|
|
328
|
-
}
|
|
329
324
|
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
330
325
|
console.warn(
|
|
331
326
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
@@ -344,7 +339,6 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
344
339
|
navigationOnly,
|
|
345
340
|
noMemory,
|
|
346
341
|
noStart,
|
|
347
|
-
noStopPropagation,
|
|
348
342
|
typeahead,
|
|
349
343
|
wrap
|
|
350
344
|
};
|
|
@@ -413,7 +407,7 @@ var RovingTabIndex = class {
|
|
|
413
407
|
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
414
408
|
return;
|
|
415
409
|
}
|
|
416
|
-
const { direction,
|
|
410
|
+
const { direction, typeahead, wrap } = this.#options;
|
|
417
411
|
const isBoth = !direction;
|
|
418
412
|
const isHorizontal = direction === "horizontal";
|
|
419
413
|
if (![
|
|
@@ -435,7 +429,6 @@ var RovingTabIndex = class {
|
|
|
435
429
|
return;
|
|
436
430
|
}
|
|
437
431
|
event.preventDefault();
|
|
438
|
-
!noStopPropagation && event.stopPropagation();
|
|
439
432
|
const currentIndex = current.indexOf(active);
|
|
440
433
|
let rawIndex;
|
|
441
434
|
let newIndex = currentIndex;
|
|
@@ -553,7 +546,7 @@ function getActiveElement() {
|
|
|
553
546
|
* Lightweight roving tabindex utility with fully focus management.
|
|
554
547
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
555
548
|
*
|
|
556
|
-
* @version
|
|
549
|
+
* @version 3.0.0
|
|
557
550
|
* @author Yusuke Kamiyamane
|
|
558
551
|
* @license MIT
|
|
559
552
|
* @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
|
|
6
|
+
* @version 3.0.0
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -14,7 +14,6 @@ interface RovingTabIndexOptions {
|
|
|
14
14
|
readonly navigationOnly?: boolean;
|
|
15
15
|
readonly noMemory?: boolean;
|
|
16
16
|
readonly noStart?: boolean;
|
|
17
|
-
readonly noStopPropagation?: boolean;
|
|
18
17
|
readonly selector?: string;
|
|
19
18
|
readonly typeahead?: boolean;
|
|
20
19
|
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
|
|
6
|
+
* @version 3.0.0
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -14,7 +14,6 @@ interface RovingTabIndexOptions {
|
|
|
14
14
|
readonly navigationOnly?: boolean;
|
|
15
15
|
readonly noMemory?: boolean;
|
|
16
16
|
readonly noStart?: boolean;
|
|
17
|
-
readonly noStopPropagation?: boolean;
|
|
18
17
|
readonly selector?: string;
|
|
19
18
|
readonly typeahead?: boolean;
|
|
20
19
|
readonly wrap?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -299,7 +299,6 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
299
299
|
navigationOnly = false,
|
|
300
300
|
noMemory = false,
|
|
301
301
|
noStart = false,
|
|
302
|
-
noStopPropagation = false,
|
|
303
302
|
selector,
|
|
304
303
|
typeahead = false,
|
|
305
304
|
wrap = false
|
|
@@ -320,10 +319,6 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
320
319
|
console.warn("Invalid noStart option. Fallback: false.");
|
|
321
320
|
noStart = false;
|
|
322
321
|
}
|
|
323
|
-
if (typeof noStopPropagation !== "boolean") {
|
|
324
|
-
console.warn("Invalid noStopPropagation option. Fallback: false.");
|
|
325
|
-
noStopPropagation = false;
|
|
326
|
-
}
|
|
327
322
|
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
328
323
|
console.warn(
|
|
329
324
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
@@ -342,7 +337,6 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
342
337
|
navigationOnly,
|
|
343
338
|
noMemory,
|
|
344
339
|
noStart,
|
|
345
|
-
noStopPropagation,
|
|
346
340
|
typeahead,
|
|
347
341
|
wrap
|
|
348
342
|
};
|
|
@@ -411,7 +405,7 @@ var RovingTabIndex = class {
|
|
|
411
405
|
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
412
406
|
return;
|
|
413
407
|
}
|
|
414
|
-
const { direction,
|
|
408
|
+
const { direction, typeahead, wrap } = this.#options;
|
|
415
409
|
const isBoth = !direction;
|
|
416
410
|
const isHorizontal = direction === "horizontal";
|
|
417
411
|
if (![
|
|
@@ -433,7 +427,6 @@ var RovingTabIndex = class {
|
|
|
433
427
|
return;
|
|
434
428
|
}
|
|
435
429
|
event.preventDefault();
|
|
436
|
-
!noStopPropagation && event.stopPropagation();
|
|
437
430
|
const currentIndex = current.indexOf(active);
|
|
438
431
|
let rawIndex;
|
|
439
432
|
let newIndex = currentIndex;
|
|
@@ -551,7 +544,7 @@ function getActiveElement() {
|
|
|
551
544
|
* Lightweight roving tabindex utility with fully focus management.
|
|
552
545
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
553
546
|
*
|
|
554
|
-
* @version
|
|
547
|
+
* @version 3.0.0
|
|
555
548
|
* @author Yusuke Kamiyamane
|
|
556
549
|
* @license MIT
|
|
557
550
|
* @copyright Copyright (c) Yusuke Kamiyamane
|