@y14e/roving-tabindex 2.0.2 → 2.0.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/README.md +4 -7
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/package.json +2 -2
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.4';
|
|
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.4';
|
|
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.4/+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.4';
|
|
24
21
|
```
|
|
25
22
|
|
|
26
23
|
## 📦 APIs
|
package/dist/index.cjs
CHANGED
|
@@ -312,7 +312,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
312
312
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
313
313
|
navigationOnly = false;
|
|
314
314
|
}
|
|
315
|
-
if (typeof selector !== "undefined" && typeof selector !== "string") {
|
|
315
|
+
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
316
316
|
console.warn(
|
|
317
317
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
318
318
|
);
|
|
@@ -327,10 +327,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
327
327
|
wrap = false;
|
|
328
328
|
}
|
|
329
329
|
const settings = { navigationOnly, typeahead, wrap };
|
|
330
|
-
if (direction
|
|
330
|
+
if (direction) {
|
|
331
331
|
Object.assign(settings, { direction });
|
|
332
332
|
}
|
|
333
|
-
if (selector
|
|
333
|
+
if (selector) {
|
|
334
334
|
Object.assign(settings, { selector });
|
|
335
335
|
}
|
|
336
336
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -375,8 +375,8 @@ var RovingTabIndex = class {
|
|
|
375
375
|
if (!event.composedPath().includes(this.#container)) {
|
|
376
376
|
return;
|
|
377
377
|
}
|
|
378
|
-
const { key, altKey, ctrlKey, metaKey } = event;
|
|
379
|
-
if (altKey || ctrlKey || metaKey) {
|
|
378
|
+
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
379
|
+
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
380
380
|
return;
|
|
381
381
|
}
|
|
382
382
|
const { direction, typeahead, wrap } = this.#options;
|
|
@@ -522,7 +522,7 @@ function getActiveElement() {
|
|
|
522
522
|
* Lightweight roving tabindex utility with fully focus management.
|
|
523
523
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
524
524
|
*
|
|
525
|
-
* @version 2.0.
|
|
525
|
+
* @version 2.0.4
|
|
526
526
|
* @author Yusuke Kamiyamane
|
|
527
527
|
* @license MIT
|
|
528
528
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -534,7 +534,7 @@ function getActiveElement() {
|
|
|
534
534
|
(**
|
|
535
535
|
* Attributes Utils
|
|
536
536
|
*
|
|
537
|
-
* @version 1.0
|
|
537
|
+
* @version 1.1.0
|
|
538
538
|
* @author Yusuke Kamiyamane
|
|
539
539
|
* @license MIT
|
|
540
540
|
* @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.0.
|
|
6
|
+
* @version 2.0.4
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
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.0.
|
|
6
|
+
* @version 2.0.4
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -310,7 +310,7 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
310
310
|
console.warn("Invalid navigationOnly option. Fallback: false.");
|
|
311
311
|
navigationOnly = false;
|
|
312
312
|
}
|
|
313
|
-
if (typeof selector !== "undefined" && typeof selector !== "string") {
|
|
313
|
+
if (typeof selector !== "undefined" && (typeof selector !== "string" || !selector.trim())) {
|
|
314
314
|
console.warn(
|
|
315
315
|
"Invalid selector. Fallback: all focusable elements (undefined)."
|
|
316
316
|
);
|
|
@@ -325,10 +325,10 @@ function createRovingTabIndex(container, options = {}) {
|
|
|
325
325
|
wrap = false;
|
|
326
326
|
}
|
|
327
327
|
const settings = { navigationOnly, typeahead, wrap };
|
|
328
|
-
if (direction
|
|
328
|
+
if (direction) {
|
|
329
329
|
Object.assign(settings, { direction });
|
|
330
330
|
}
|
|
331
|
-
if (selector
|
|
331
|
+
if (selector) {
|
|
332
332
|
Object.assign(settings, { selector });
|
|
333
333
|
}
|
|
334
334
|
const roving = new RovingTabIndex(container, settings);
|
|
@@ -373,8 +373,8 @@ var RovingTabIndex = class {
|
|
|
373
373
|
if (!event.composedPath().includes(this.#container)) {
|
|
374
374
|
return;
|
|
375
375
|
}
|
|
376
|
-
const { key, altKey, ctrlKey, metaKey } = event;
|
|
377
|
-
if (altKey || ctrlKey || metaKey) {
|
|
376
|
+
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
377
|
+
if (altKey || ctrlKey || metaKey || shiftKey) {
|
|
378
378
|
return;
|
|
379
379
|
}
|
|
380
380
|
const { direction, typeahead, wrap } = this.#options;
|
|
@@ -520,7 +520,7 @@ function getActiveElement() {
|
|
|
520
520
|
* Lightweight roving tabindex utility with fully focus management.
|
|
521
521
|
* Designed for accessible menus, tabs, toolbars, and composite widgets.
|
|
522
522
|
*
|
|
523
|
-
* @version 2.0.
|
|
523
|
+
* @version 2.0.4
|
|
524
524
|
* @author Yusuke Kamiyamane
|
|
525
525
|
* @license MIT
|
|
526
526
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -532,7 +532,7 @@ function getActiveElement() {
|
|
|
532
532
|
(**
|
|
533
533
|
* Attributes Utils
|
|
534
534
|
*
|
|
535
|
-
* @version 1.0
|
|
535
|
+
* @version 1.1.0
|
|
536
536
|
* @author Yusuke Kamiyamane
|
|
537
537
|
* @license MIT
|
|
538
538
|
* @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.4",
|
|
4
4
|
"description": "Lightweight roving tabindex utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -48,7 +48,7 @@
|
|
|
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
53
|
"power-focusable": "^4.3.1",
|
|
54
54
|
"tsup": "^8.0.0",
|