@y14e/portal 1.3.0 → 1.3.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 +3 -3
- package/dist/index.bundle.cjs +14 -14
- package/dist/index.bundle.js +14 -14
- package/dist/index.cjs +36 -15
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -15
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,11 +13,11 @@ npm i @y14e/portal
|
|
|
13
13
|
import { createPortal } from '@y14e/portal';
|
|
14
14
|
|
|
15
15
|
// CDNs
|
|
16
|
-
import { createPortal } from 'https://esm.sh/@y14e/portal@1.3.
|
|
16
|
+
import { createPortal } from 'https://esm.sh/@y14e/portal@1.3.1';
|
|
17
17
|
// or
|
|
18
|
-
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.
|
|
18
|
+
import { createPortal } from 'https://cdn.jsdelivr.net/npm/@y14e/portal@1.3.1/+esm';
|
|
19
19
|
// or
|
|
20
|
-
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.
|
|
20
|
+
import { createPortal } from 'https://esm.unpkg.com/@y14e/portal@1.3.1';
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## 📦 APIs
|
package/dist/index.bundle.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
// node_modules/@y14e/
|
|
3
|
+
// node_modules/@y14e/attribute-util/dist/index.js
|
|
4
4
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
5
5
|
function restoreAttributes(element_or_elements) {
|
|
6
6
|
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
@@ -8,22 +8,22 @@ function restoreAttributes(element_or_elements) {
|
|
|
8
8
|
if (!snapshot) {
|
|
9
9
|
continue;
|
|
10
10
|
}
|
|
11
|
-
for (const [
|
|
12
|
-
value === null ? element.removeAttribute(
|
|
11
|
+
for (const [name, value] of snapshot.entries()) {
|
|
12
|
+
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
13
13
|
}
|
|
14
14
|
snapshots.delete(element);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
|
-
function saveAttributes(element_or_elements,
|
|
18
|
-
const
|
|
17
|
+
function saveAttributes(element_or_elements, name_or_names) {
|
|
18
|
+
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
19
19
|
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
20
20
|
let snapshot = snapshots.get(element);
|
|
21
21
|
if (!snapshot) {
|
|
22
22
|
snapshot = /* @__PURE__ */ new Map();
|
|
23
23
|
snapshots.set(element, snapshot);
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
snapshot.set(
|
|
25
|
+
names.forEach((name) => {
|
|
26
|
+
snapshot.set(name, element.getAttribute(name));
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
}
|
|
@@ -502,7 +502,7 @@ var Portal = class {
|
|
|
502
502
|
return;
|
|
503
503
|
}
|
|
504
504
|
this.#update();
|
|
505
|
-
const focusables = this.#
|
|
505
|
+
const focusables = getFocusables(this.#host);
|
|
506
506
|
if (focusables.length) {
|
|
507
507
|
const index = focusables.indexOf(active);
|
|
508
508
|
if (index >= 0) {
|
|
@@ -577,7 +577,7 @@ function containsComposed2(container, element) {
|
|
|
577
577
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
578
578
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
579
579
|
*
|
|
580
|
-
* @version 1.3.
|
|
580
|
+
* @version 1.3.1
|
|
581
581
|
* @author Yusuke Kamiyamane
|
|
582
582
|
* @license MIT
|
|
583
583
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -585,15 +585,15 @@ function containsComposed2(container, element) {
|
|
|
585
585
|
*/
|
|
586
586
|
/*! Bundled license information:
|
|
587
587
|
|
|
588
|
-
@y14e/
|
|
588
|
+
@y14e/attribute-util/dist/index.js:
|
|
589
589
|
(**
|
|
590
|
-
*
|
|
590
|
+
* Attribute Util
|
|
591
591
|
*
|
|
592
|
-
* @version
|
|
592
|
+
* @version 2.0.0
|
|
593
593
|
* @author Yusuke Kamiyamane
|
|
594
594
|
* @license MIT
|
|
595
595
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
596
|
-
* @see {@link https://github.com/y14e/
|
|
596
|
+
* @see {@link https://github.com/y14e/attribute-util}
|
|
597
597
|
*)
|
|
598
598
|
|
|
599
599
|
power-focusable/dist/index.js:
|
|
@@ -602,7 +602,7 @@ power-focusable/dist/index.js:
|
|
|
602
602
|
* High-precision focus management utility with full composed tree support.
|
|
603
603
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
604
604
|
*
|
|
605
|
-
* @version 4.3.
|
|
605
|
+
* @version 4.3.23
|
|
606
606
|
* @author Yusuke Kamiyamane
|
|
607
607
|
* @license MIT
|
|
608
608
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.bundle.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// node_modules/@y14e/
|
|
1
|
+
// node_modules/@y14e/attribute-util/dist/index.js
|
|
2
2
|
var snapshots = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
function restoreAttributes(element_or_elements) {
|
|
4
4
|
for (const element of Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]) {
|
|
@@ -6,22 +6,22 @@ function restoreAttributes(element_or_elements) {
|
|
|
6
6
|
if (!snapshot) {
|
|
7
7
|
continue;
|
|
8
8
|
}
|
|
9
|
-
for (const [
|
|
10
|
-
value === null ? element.removeAttribute(
|
|
9
|
+
for (const [name, value] of snapshot.entries()) {
|
|
10
|
+
value === null ? element.removeAttribute(name) : element.setAttribute(name, value);
|
|
11
11
|
}
|
|
12
12
|
snapshots.delete(element);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
function saveAttributes(element_or_elements,
|
|
16
|
-
const
|
|
15
|
+
function saveAttributes(element_or_elements, name_or_names) {
|
|
16
|
+
const names = Array.isArray(name_or_names) ? name_or_names : [name_or_names];
|
|
17
17
|
(Array.isArray(element_or_elements) ? element_or_elements : [element_or_elements]).forEach((element) => {
|
|
18
18
|
let snapshot = snapshots.get(element);
|
|
19
19
|
if (!snapshot) {
|
|
20
20
|
snapshot = /* @__PURE__ */ new Map();
|
|
21
21
|
snapshots.set(element, snapshot);
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
snapshot.set(
|
|
23
|
+
names.forEach((name) => {
|
|
24
|
+
snapshot.set(name, element.getAttribute(name));
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -500,7 +500,7 @@ var Portal = class {
|
|
|
500
500
|
return;
|
|
501
501
|
}
|
|
502
502
|
this.#update();
|
|
503
|
-
const focusables = this.#
|
|
503
|
+
const focusables = getFocusables(this.#host);
|
|
504
504
|
if (focusables.length) {
|
|
505
505
|
const index = focusables.indexOf(active);
|
|
506
506
|
if (index >= 0) {
|
|
@@ -575,7 +575,7 @@ function containsComposed2(container, element) {
|
|
|
575
575
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
576
576
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
577
577
|
*
|
|
578
|
-
* @version 1.3.
|
|
578
|
+
* @version 1.3.1
|
|
579
579
|
* @author Yusuke Kamiyamane
|
|
580
580
|
* @license MIT
|
|
581
581
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
@@ -583,15 +583,15 @@ function containsComposed2(container, element) {
|
|
|
583
583
|
*/
|
|
584
584
|
/*! Bundled license information:
|
|
585
585
|
|
|
586
|
-
@y14e/
|
|
586
|
+
@y14e/attribute-util/dist/index.js:
|
|
587
587
|
(**
|
|
588
|
-
*
|
|
588
|
+
* Attribute Util
|
|
589
589
|
*
|
|
590
|
-
* @version
|
|
590
|
+
* @version 2.0.0
|
|
591
591
|
* @author Yusuke Kamiyamane
|
|
592
592
|
* @license MIT
|
|
593
593
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
|
594
|
-
* @see {@link https://github.com/y14e/
|
|
594
|
+
* @see {@link https://github.com/y14e/attribute-util}
|
|
595
595
|
*)
|
|
596
596
|
|
|
597
597
|
power-focusable/dist/index.js:
|
|
@@ -600,7 +600,7 @@ power-focusable/dist/index.js:
|
|
|
600
600
|
* High-precision focus management utility with full composed tree support.
|
|
601
601
|
* Handles complex focus rules including tabindex ordering, radio groups, inert.
|
|
602
602
|
*
|
|
603
|
-
* @version 4.3.
|
|
603
|
+
* @version 4.3.23
|
|
604
604
|
* @author Yusuke Kamiyamane
|
|
605
605
|
* @license MIT
|
|
606
606
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var util = require('@y14e/attribute-util');
|
|
4
|
+
var pf = require('power-focusable');
|
|
5
|
+
|
|
6
|
+
function _interopNamespace(e) {
|
|
7
|
+
if (e && e.__esModule) return e;
|
|
8
|
+
var n = Object.create(null);
|
|
9
|
+
if (e) {
|
|
10
|
+
Object.keys(e).forEach(function (k) {
|
|
11
|
+
if (k !== 'default') {
|
|
12
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
+
enumerable: true,
|
|
15
|
+
get: function () { return e[k]; }
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
n.default = e;
|
|
21
|
+
return Object.freeze(n);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var util__namespace = /*#__PURE__*/_interopNamespace(util);
|
|
25
|
+
var pf__namespace = /*#__PURE__*/_interopNamespace(pf);
|
|
5
26
|
|
|
6
27
|
// src/index.ts
|
|
7
28
|
var VISUALLY_HIDDEN_CSS = `border: 0; clip: rect(0, 0, 0, 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; user-select: none; white-space: nowrap; width: 1px;`;
|
|
@@ -57,7 +78,7 @@ var Portal = class {
|
|
|
57
78
|
this.#isDestroyed = true;
|
|
58
79
|
this.#controller?.abort();
|
|
59
80
|
this.#controller = null;
|
|
60
|
-
|
|
81
|
+
util__namespace.restoreAttributes([...this.#focusables]);
|
|
61
82
|
this.#focusables.clear();
|
|
62
83
|
this.#exitSentinel.after(this.#host);
|
|
63
84
|
this.#entranceSentinel.remove();
|
|
@@ -89,7 +110,7 @@ var Portal = class {
|
|
|
89
110
|
}
|
|
90
111
|
this.#update();
|
|
91
112
|
const first = [...this.#focusables][0];
|
|
92
|
-
first ?
|
|
113
|
+
first ? pf__namespace.focusElement(first) : this.#moveFocus("next");
|
|
93
114
|
} else {
|
|
94
115
|
if (this.#host.contains(previous)) {
|
|
95
116
|
this.#moveFocus("next");
|
|
@@ -97,7 +118,7 @@ var Portal = class {
|
|
|
97
118
|
}
|
|
98
119
|
this.#update();
|
|
99
120
|
const last = [...this.#focusables].at(-1);
|
|
100
|
-
last ?
|
|
121
|
+
last ? pf__namespace.focusElement(last) : this.#moveFocus("previous");
|
|
101
122
|
}
|
|
102
123
|
};
|
|
103
124
|
#onKeyDown = (event) => {
|
|
@@ -108,18 +129,18 @@ var Portal = class {
|
|
|
108
129
|
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
109
130
|
return;
|
|
110
131
|
}
|
|
111
|
-
const active =
|
|
132
|
+
const active = pf__namespace.getActiveElement();
|
|
112
133
|
if (!(active instanceof Element)) {
|
|
113
134
|
return;
|
|
114
135
|
}
|
|
115
136
|
this.#update();
|
|
116
|
-
const focusables = this.#
|
|
137
|
+
const focusables = pf__namespace.getFocusables(this.#host);
|
|
117
138
|
if (focusables.length) {
|
|
118
139
|
const index = focusables.indexOf(active);
|
|
119
140
|
if (index >= 0) {
|
|
120
141
|
event.preventDefault();
|
|
121
142
|
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
122
|
-
focusable ?
|
|
143
|
+
focusable ? pf__namespace.focusElement(focusable) : this.#focusSentinel(shiftKey);
|
|
123
144
|
}
|
|
124
145
|
} else {
|
|
125
146
|
event.preventDefault();
|
|
@@ -129,18 +150,18 @@ var Portal = class {
|
|
|
129
150
|
#update() {
|
|
130
151
|
const current = /* @__PURE__ */ new Set([
|
|
131
152
|
...this.#getFocusables(),
|
|
132
|
-
...
|
|
153
|
+
...pf__namespace.getFocusables(this.#host, { composed: true })
|
|
133
154
|
]);
|
|
134
155
|
for (const focusable of this.#focusables) {
|
|
135
156
|
if (!current.has(focusable)) {
|
|
136
|
-
|
|
157
|
+
util__namespace.restoreAttributes(focusable);
|
|
137
158
|
this.#focusables.delete(focusable);
|
|
138
159
|
}
|
|
139
160
|
}
|
|
140
161
|
for (const focusable of current) {
|
|
141
162
|
if (!this.#focusables.has(focusable)) {
|
|
142
163
|
this.#focusables.add(focusable);
|
|
143
|
-
|
|
164
|
+
util__namespace.saveAttributes(focusable, "tabindex");
|
|
144
165
|
focusable.setAttribute("tabindex", "-1");
|
|
145
166
|
}
|
|
146
167
|
}
|
|
@@ -159,7 +180,7 @@ var Portal = class {
|
|
|
159
180
|
(isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus();
|
|
160
181
|
}
|
|
161
182
|
#getFocusables() {
|
|
162
|
-
return
|
|
183
|
+
return pf__namespace.getFocusables(this.#host, {
|
|
163
184
|
composed: true,
|
|
164
185
|
include: (element) => this.#focusables.has(element)
|
|
165
186
|
});
|
|
@@ -169,8 +190,8 @@ var Portal = class {
|
|
|
169
190
|
anchor: direction === "previous" ? this.#entranceSentinel : this.#exitSentinel,
|
|
170
191
|
composed: true
|
|
171
192
|
};
|
|
172
|
-
const focusable = direction === "previous" ?
|
|
173
|
-
focusable &&
|
|
193
|
+
const focusable = direction === "previous" ? pf__namespace.getPreviousFocusable(document.body, options) : pf__namespace.getNextFocusable(document.body, options);
|
|
194
|
+
focusable && pf__namespace.focusElement(focusable);
|
|
174
195
|
}
|
|
175
196
|
};
|
|
176
197
|
function containsComposed(container, element) {
|
|
@@ -188,7 +209,7 @@ function containsComposed(container, element) {
|
|
|
188
209
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
189
210
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
190
211
|
*
|
|
191
|
-
* @version 1.3.
|
|
212
|
+
* @version 1.3.1
|
|
192
213
|
* @author Yusuke Kamiyamane
|
|
193
214
|
* @license MIT
|
|
194
215
|
* @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.3.
|
|
6
|
+
* @version 1.3.1
|
|
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.3.
|
|
6
|
+
* @version 1.3.1
|
|
7
7
|
* @author Yusuke Kamiyamane
|
|
8
8
|
* @license MIT
|
|
9
9
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import * as util from '@y14e/attribute-util';
|
|
2
|
+
import * as pf from 'power-focusable';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
var VISUALLY_HIDDEN_CSS = `border: 0; clip: rect(0, 0, 0, 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; user-select: none; white-space: nowrap; width: 1px;`;
|
|
@@ -55,7 +55,7 @@ var Portal = class {
|
|
|
55
55
|
this.#isDestroyed = true;
|
|
56
56
|
this.#controller?.abort();
|
|
57
57
|
this.#controller = null;
|
|
58
|
-
restoreAttributes([...this.#focusables]);
|
|
58
|
+
util.restoreAttributes([...this.#focusables]);
|
|
59
59
|
this.#focusables.clear();
|
|
60
60
|
this.#exitSentinel.after(this.#host);
|
|
61
61
|
this.#entranceSentinel.remove();
|
|
@@ -87,7 +87,7 @@ var Portal = class {
|
|
|
87
87
|
}
|
|
88
88
|
this.#update();
|
|
89
89
|
const first = [...this.#focusables][0];
|
|
90
|
-
first ? focusElement(first) : this.#moveFocus("next");
|
|
90
|
+
first ? pf.focusElement(first) : this.#moveFocus("next");
|
|
91
91
|
} else {
|
|
92
92
|
if (this.#host.contains(previous)) {
|
|
93
93
|
this.#moveFocus("next");
|
|
@@ -95,7 +95,7 @@ var Portal = class {
|
|
|
95
95
|
}
|
|
96
96
|
this.#update();
|
|
97
97
|
const last = [...this.#focusables].at(-1);
|
|
98
|
-
last ? focusElement(last) : this.#moveFocus("previous");
|
|
98
|
+
last ? pf.focusElement(last) : this.#moveFocus("previous");
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
#onKeyDown = (event) => {
|
|
@@ -106,18 +106,18 @@ var Portal = class {
|
|
|
106
106
|
if (key !== "Tab" || altKey || ctrlKey || metaKey) {
|
|
107
107
|
return;
|
|
108
108
|
}
|
|
109
|
-
const active = getActiveElement();
|
|
109
|
+
const active = pf.getActiveElement();
|
|
110
110
|
if (!(active instanceof Element)) {
|
|
111
111
|
return;
|
|
112
112
|
}
|
|
113
113
|
this.#update();
|
|
114
|
-
const focusables = this.#
|
|
114
|
+
const focusables = pf.getFocusables(this.#host);
|
|
115
115
|
if (focusables.length) {
|
|
116
116
|
const index = focusables.indexOf(active);
|
|
117
117
|
if (index >= 0) {
|
|
118
118
|
event.preventDefault();
|
|
119
119
|
const focusable = focusables[index + (shiftKey ? -1 : 1)];
|
|
120
|
-
focusable ? focusElement(focusable) : this.#focusSentinel(shiftKey);
|
|
120
|
+
focusable ? pf.focusElement(focusable) : this.#focusSentinel(shiftKey);
|
|
121
121
|
}
|
|
122
122
|
} else {
|
|
123
123
|
event.preventDefault();
|
|
@@ -127,18 +127,18 @@ var Portal = class {
|
|
|
127
127
|
#update() {
|
|
128
128
|
const current = /* @__PURE__ */ new Set([
|
|
129
129
|
...this.#getFocusables(),
|
|
130
|
-
...getFocusables(this.#host, { composed: true })
|
|
130
|
+
...pf.getFocusables(this.#host, { composed: true })
|
|
131
131
|
]);
|
|
132
132
|
for (const focusable of this.#focusables) {
|
|
133
133
|
if (!current.has(focusable)) {
|
|
134
|
-
restoreAttributes(focusable);
|
|
134
|
+
util.restoreAttributes(focusable);
|
|
135
135
|
this.#focusables.delete(focusable);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
for (const focusable of current) {
|
|
139
139
|
if (!this.#focusables.has(focusable)) {
|
|
140
140
|
this.#focusables.add(focusable);
|
|
141
|
-
saveAttributes(focusable, "tabindex");
|
|
141
|
+
util.saveAttributes(focusable, "tabindex");
|
|
142
142
|
focusable.setAttribute("tabindex", "-1");
|
|
143
143
|
}
|
|
144
144
|
}
|
|
@@ -157,7 +157,7 @@ var Portal = class {
|
|
|
157
157
|
(isPrevious ? this.#entranceSentinel : this.#exitSentinel).focus();
|
|
158
158
|
}
|
|
159
159
|
#getFocusables() {
|
|
160
|
-
return getFocusables(this.#host, {
|
|
160
|
+
return pf.getFocusables(this.#host, {
|
|
161
161
|
composed: true,
|
|
162
162
|
include: (element) => this.#focusables.has(element)
|
|
163
163
|
});
|
|
@@ -167,8 +167,8 @@ var Portal = class {
|
|
|
167
167
|
anchor: direction === "previous" ? this.#entranceSentinel : this.#exitSentinel,
|
|
168
168
|
composed: true
|
|
169
169
|
};
|
|
170
|
-
const focusable = direction === "previous" ? getPreviousFocusable(document.body, options) : getNextFocusable(document.body, options);
|
|
171
|
-
focusable && focusElement(focusable);
|
|
170
|
+
const focusable = direction === "previous" ? pf.getPreviousFocusable(document.body, options) : pf.getNextFocusable(document.body, options);
|
|
171
|
+
focusable && pf.focusElement(focusable);
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
174
|
function containsComposed(container, element) {
|
|
@@ -186,7 +186,7 @@ function containsComposed(container, element) {
|
|
|
186
186
|
* Lightweight DOM portal (teleport) utility with fully focus management.
|
|
187
187
|
* Designed for accessible dialogs, menus, overlays, popovers.
|
|
188
188
|
*
|
|
189
|
-
* @version 1.3.
|
|
189
|
+
* @version 1.3.1
|
|
190
190
|
* @author Yusuke Kamiyamane
|
|
191
191
|
* @license MIT
|
|
192
192
|
* @copyright Copyright (c) Yusuke Kamiyamane
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@y14e/portal",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Lightweight DOM portal (teleport) utility with fully focus management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"node": ">=18"
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
|
-
"@y14e/
|
|
59
|
-
"power-focusable": "^4.3.
|
|
58
|
+
"@y14e/attribute-util": "^2.0.0",
|
|
59
|
+
"power-focusable": "^4.3.23"
|
|
60
60
|
}
|
|
61
61
|
}
|