@y14e/roving-tabindex 2.0.1 → 2.0.3
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 +9 -12
- package/dist/index.cjs +13 -12
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +13 -12
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Lightweight roving `tabindex` utility with fully focus management. Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
4
4
|
|
|
5
|
-
> [!NOTE]
|
|
6
|
-
> Focus traversal works across shadow DOM boundaries using composed-tree-aware focus detection powered by [Power Focusable](https://github.com/y14e/power-focusable).
|
|
7
|
-
|
|
8
5
|
## Install
|
|
9
6
|
|
|
10
7
|
```bash
|
|
@@ -13,14 +10,14 @@ npm i @y14e/roving-tabindex
|
|
|
13
10
|
|
|
14
11
|
```ts
|
|
15
12
|
// npm
|
|
16
|
-
import { createRovingTabIndex } from '@y14e/roving-tabindex';
|
|
13
|
+
import { createRovingTabIndex } from '@y14e/roving-tabindex@2.0.3';
|
|
17
14
|
|
|
18
15
|
// CDNs
|
|
19
|
-
import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex'
|
|
16
|
+
import { createRovingTabIndex } from 'https://esm.sh/@y14e/roving-tabindex@2.0.3';
|
|
20
17
|
// or
|
|
21
|
-
import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex/+esm';
|
|
18
|
+
import { createRovingTabIndex } from 'https://cdn.jsdelivr.net/npm/@y14e/roving-tabindex@2.0.3/+esm';
|
|
22
19
|
// or
|
|
23
|
-
import { createRovingTabIndex } from 'https://unpkg.com/@y14e/roving-tabindex
|
|
20
|
+
import { createRovingTabIndex } from 'https://esm.unpkg.com/@y14e/roving-tabindex@2.0.3';
|
|
24
21
|
```
|
|
25
22
|
|
|
26
23
|
## 📦 APIs
|
|
@@ -41,11 +38,11 @@ const cleanup = createRovingTabIndex(container, options);
|
|
|
41
38
|
|
|
42
39
|
```ts
|
|
43
40
|
interface RovingTabIndexOptions {
|
|
44
|
-
direction?: 'horizontal' | 'vertical'
|
|
45
|
-
navigationOnly?: boolean;
|
|
46
|
-
selector?: string
|
|
47
|
-
typeahead?: boolean;
|
|
48
|
-
wrap?: boolean;
|
|
41
|
+
direction?: 'horizontal' | 'vertical'; // default: both (undefined)
|
|
42
|
+
navigationOnly?: boolean; // default: false
|
|
43
|
+
selector?: string;
|
|
44
|
+
typeahead?: boolean; // default: false
|
|
45
|
+
wrap?: boolean; // default: false
|
|
49
46
|
}
|
|
50
47
|
```
|
|
51
48
|
|
package/dist/index.cjs
CHANGED
|
@@ -326,13 +326,14 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
326
326
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
327
327
|
wrap = false;
|
|
328
328
|
}
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
329
|
+
const settings = { navigationOnly, typeahead, wrap };
|
|
330
|
+
if (direction !== void 0) {
|
|
331
|
+
Object.assign(settings, { direction });
|
|
332
|
+
}
|
|
333
|
+
if (selector !== void 0) {
|
|
334
|
+
Object.assign(settings, { selector });
|
|
335
|
+
}
|
|
336
|
+
const roving = new RovingTabIndex(container, settings);
|
|
336
337
|
return () => roving.destroy();
|
|
337
338
|
}
|
|
338
339
|
var RovingTabIndex = class {
|
|
@@ -374,8 +375,8 @@ var RovingTabIndex = class {
|
|
|
374
375
|
if (!event.composedPath().includes(this.#container)) {
|
|
375
376
|
return;
|
|
376
377
|
}
|
|
377
|
-
const { key, altKey, ctrlKey, metaKey } = event;
|
|
378
|
-
if (altKey || ctrlKey || metaKey) {
|
|
378
|
+
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
379
|
+
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
379
380
|
return;
|
|
380
381
|
}
|
|
381
382
|
const { direction, typeahead, wrap } = this.#options;
|
|
@@ -521,7 +522,7 @@ function getActiveElement() {
|
|
|
521
522
|
* Lightweight roving tabindex utility with fully focus management.
|
|
522
523
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
523
524
|
*
|
|
524
|
-
* @version 2.0.
|
|
525
|
+
* @version 2.0.3
|
|
525
526
|
* @author Yusuke Kamiyamane
|
|
526
527
|
* @license MIT
|
|
527
528
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -533,7 +534,7 @@ function getActiveElement() {
|
|
|
533
534
|
(**
|
|
534
535
|
* Attributes Utils
|
|
535
536
|
*
|
|
536
|
-
* @version 1.0
|
|
537
|
+
* @version 1.1.0
|
|
537
538
|
* @author Yusuke Kamiyamane
|
|
538
539
|
* @license MIT
|
|
539
540
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -546,7 +547,7 @@ power-focusable/dist/index.js:
|
|
|
546
547
|
* High-precision focus management utility with full composed tree support.
|
|
547
548
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
548
549
|
*
|
|
549
|
-
* @version 4.3.
|
|
550
|
+
* @version 4.3.1
|
|
550
551
|
* @author Yusuke Kamiyamane
|
|
551
552
|
* @license MIT
|
|
552
553
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
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.0.
|
|
6
|
+
* @version 2.0.3
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
10
10
|
* @see {@link https://github.com/y14e/roving-tabindex}
|
|
11
11
|
*/
|
|
12
12
|
interface RovingTabIndexOptions {
|
|
13
|
-
readonly direction?: 'horizontal' | 'vertical'
|
|
13
|
+
readonly direction?: 'horizontal' | 'vertical';
|
|
14
14
|
readonly navigationOnly?: boolean;
|
|
15
|
-
readonly selector?: string
|
|
15
|
+
readonly selector?: string;
|
|
16
16
|
readonly typeahead?: boolean;
|
|
17
17
|
readonly wrap?: boolean;
|
|
18
18
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
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.0.
|
|
6
|
+
* @version 2.0.3
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
10
10
|
* @see {@link https://github.com/y14e/roving-tabindex}
|
|
11
11
|
*/
|
|
12
12
|
interface RovingTabIndexOptions {
|
|
13
|
-
readonly direction?: 'horizontal' | 'vertical'
|
|
13
|
+
readonly direction?: 'horizontal' | 'vertical';
|
|
14
14
|
readonly navigationOnly?: boolean;
|
|
15
|
-
readonly selector?: string
|
|
15
|
+
readonly selector?: string;
|
|
16
16
|
readonly typeahead?: boolean;
|
|
17
17
|
readonly wrap?: boolean;
|
|
18
18
|
}
|
package/dist/index.js
CHANGED
|
@@ -324,13 +324,14 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
324
324
|
console.warn("Invalid wrap option. Fallback: false.");
|
|
325
325
|
wrap = false;
|
|
326
326
|
}
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
327
|
+
const settings = { navigationOnly, typeahead, wrap };
|
|
328
|
+
if (direction !== void 0) {
|
|
329
|
+
Object.assign(settings, { direction });
|
|
330
|
+
}
|
|
331
|
+
if (selector !== void 0) {
|
|
332
|
+
Object.assign(settings, { selector });
|
|
333
|
+
}
|
|
334
|
+
const roving = new RovingTabIndex(container, settings);
|
|
334
335
|
return () => roving.destroy();
|
|
335
336
|
}
|
|
336
337
|
var RovingTabIndex = class {
|
|
@@ -372,8 +373,8 @@ var RovingTabIndex = class {
|
|
|
372
373
|
if (!event.composedPath().includes(this.#container)) {
|
|
373
374
|
return;
|
|
374
375
|
}
|
|
375
|
-
const { key, altKey, ctrlKey, metaKey } = event;
|
|
376
|
-
if (altKey || ctrlKey || metaKey) {
|
|
376
|
+
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
377
|
+
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
377
378
|
return;
|
|
378
379
|
}
|
|
379
380
|
const { direction, typeahead, wrap } = this.#options;
|
|
@@ -519,7 +520,7 @@ function getActiveElement() {
|
|
|
519
520
|
* Lightweight roving tabindex utility with fully focus management.
|
|
520
521
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
521
522
|
*
|
|
522
|
-
* @version 2.0.
|
|
523
|
+
* @version 2.0.3
|
|
523
524
|
* @author Yusuke Kamiyamane
|
|
524
525
|
* @license MIT
|
|
525
526
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -531,7 +532,7 @@ function getActiveElement() {
|
|
|
531
532
|
(**
|
|
532
533
|
* Attributes Utils
|
|
533
534
|
*
|
|
534
|
-
* @version 1.0
|
|
535
|
+
* @version 1.1.0
|
|
535
536
|
* @author Yusuke Kamiyamane
|
|
536
537
|
* @license MIT
|
|
537
538
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -544,7 +545,7 @@ power-focusable/dist/index.js:
|
|
|
544
545
|
* High-precision focus management utility with full composed tree support.
|
|
545
546
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
546
547
|
*
|
|
547
|
-
* @version 4.3.
|
|
548
|
+
* @version 4.3.1
|
|
548
549
|
* @author Yusuke Kamiyamane
|
|
549
550
|
* @license MIT
|
|
550
551
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/roving-tabindex",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"description": "Lightweight roving tabindex utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/y14e/roving-tabindex#readme",
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@y14e/attributes-utils": "^1.0
|
|
51
|
+
"@y14e/attributes-utils": "^1.1.0",
|
|
52
52
|
"bun-types": "latest",
|
|
53
|
-
"power-focusable": "^4.3.
|
|
53
|
+
"power-focusable": "^4.3.1",
|
|
54
54
|
"tsup": "^8.0.0",
|
|
55
55
|
"typescript": "^5.6.0"
|
|
56
56
|
},
|