@y14e/portal 1.2.2 → 1.2.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/dist/index.cjs +6 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -370,7 +370,8 @@ var Portal = class {
|
|
|
370
370
|
}
|
|
371
371
|
};
|
|
372
372
|
#onKeyDown = (event) => {
|
|
373
|
-
|
|
373
|
+
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
374
|
+
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
374
375
|
return;
|
|
375
376
|
}
|
|
376
377
|
const active = getActiveElement2();
|
|
@@ -384,7 +385,7 @@ var Portal = class {
|
|
|
384
385
|
const focusables = this.#getFocusables();
|
|
385
386
|
if (!focusables.length) {
|
|
386
387
|
event.preventDefault();
|
|
387
|
-
this.#focusSentinel(
|
|
388
|
+
this.#focusSentinel(shiftKey);
|
|
388
389
|
return;
|
|
389
390
|
}
|
|
390
391
|
const index = focusables.indexOf(active);
|
|
@@ -392,11 +393,11 @@ var Portal = class {
|
|
|
392
393
|
return;
|
|
393
394
|
}
|
|
394
395
|
event.preventDefault();
|
|
395
|
-
const focusable = focusables[index + (
|
|
396
|
+
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
396
397
|
if (focusable) {
|
|
397
398
|
focusElement(focusable);
|
|
398
399
|
} else {
|
|
399
|
-
this.#focusSentinel(
|
|
400
|
+
this.#focusSentinel(shiftKey);
|
|
400
401
|
}
|
|
401
402
|
};
|
|
402
403
|
#update() {
|
|
@@ -481,7 +482,7 @@ function getActiveElement2() {
|
|
|
481
482
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
482
483
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
483
484
|
*
|
|
484
|
-
* @version 1.2.
|
|
485
|
+
* @version 1.2.3
|
|
485
486
|
* @author Yusuke Kamiyamane
|
|
486
487
|
* @license MIT
|
|
487
488
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.d.cts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
4
4
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.2.
|
|
6
|
+
* @version 1.2.3
|
|
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 DOM portal (teleport) utility with fully focus management.
|
|
4
4
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
5
5
|
*
|
|
6
|
-
* @version 1.2.
|
|
6
|
+
* @version 1.2.3
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -368,7 +368,8 @@ var Portal = class {
|
|
|
368
368
|
}
|
|
369
369
|
};
|
|
370
370
|
#onKeyDown = (event) => {
|
|
371
|
-
|
|
371
|
+
const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
|
|
372
|
+
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
372
373
|
return;
|
|
373
374
|
}
|
|
374
375
|
const active = getActiveElement2();
|
|
@@ -382,7 +383,7 @@ var Portal = class {
|
|
|
382
383
|
const focusables = this.#getFocusables();
|
|
383
384
|
if (!focusables.length) {
|
|
384
385
|
event.preventDefault();
|
|
385
|
-
this.#focusSentinel(
|
|
386
|
+
this.#focusSentinel(shiftKey);
|
|
386
387
|
return;
|
|
387
388
|
}
|
|
388
389
|
const index = focusables.indexOf(active);
|
|
@@ -390,11 +391,11 @@ var Portal = class {
|
|
|
390
391
|
return;
|
|
391
392
|
}
|
|
392
393
|
event.preventDefault();
|
|
393
|
-
const focusable = focusables[index + (
|
|
394
|
+
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
394
395
|
if (focusable) {
|
|
395
396
|
focusElement(focusable);
|
|
396
397
|
} else {
|
|
397
|
-
this.#focusSentinel(
|
|
398
|
+
this.#focusSentinel(shiftKey);
|
|
398
399
|
}
|
|
399
400
|
};
|
|
400
401
|
#update() {
|
|
@@ -479,7 +480,7 @@ function getActiveElement2() {
|
|
|
479
480
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
480
481
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
481
482
|
*
|
|
482
|
-
* @version 1.2.
|
|
483
|
+
* @version 1.2.3
|
|
483
484
|
* @author Yusuke Kamiyamane
|
|
484
485
|
* @license MIT
|
|
485
486
|
* @copyright Copyright (c) Yusuke Kamiyamane
|