@y14e/portal 1.4.3 → 1.4.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.
@@ -49,7 +49,7 @@ function getFocusables(container = document.body, options = {}) {
49
49
  const candidates = [];
50
50
  if (!composed && !include) {
51
51
  for (const match of container.querySelectorAll(
52
- skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
52
+ !skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR : FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX
53
53
  )) {
54
54
  match && isFocusable(match, {
55
55
  skipNegativeTabIndexCheck,
@@ -409,7 +409,9 @@ var Portal = class {
409
409
  for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
410
410
  sentinel.addEventListener("focus", this.#onFocus, { signal });
411
411
  }
412
- this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
412
+ this.#host.addEventListener("keydown", this.#onKeyDown, {
413
+ signal
414
+ });
413
415
  this.#host.setAttribute("data-portaled", "");
414
416
  }
415
417
  #onFocus = (event) => {
@@ -436,9 +438,6 @@ var Portal = class {
436
438
  last ? focusElement(last) : this.#moveFocus("previous");
437
439
  };
438
440
  #onKeyDown = (event) => {
439
- if (!(event instanceof KeyboardEvent)) {
440
- return;
441
- }
442
441
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
443
442
  if (key !== "Tab" || altKey || ctrlKey || metaKey) {
444
443
  return;
@@ -47,7 +47,7 @@ function getFocusables(container = document.body, options = {}) {
47
47
  const candidates = [];
48
48
  if (!composed && !include) {
49
49
  for (const match of container.querySelectorAll(
50
- skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX : FOCUSABLE_SELECTOR
50
+ !skipNegativeTabIndexCheck ? FOCUSABLE_SELECTOR : FOCUSABLE_SELECTOR_WITH_NEGATIVE_TABINDEX
51
51
  )) {
52
52
  match && isFocusable(match, {
53
53
  skipNegativeTabIndexCheck,
@@ -407,7 +407,9 @@ var Portal = class {
407
407
  for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
408
408
  sentinel.addEventListener("focus", this.#onFocus, { signal });
409
409
  }
410
- this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
410
+ this.#host.addEventListener("keydown", this.#onKeyDown, {
411
+ signal
412
+ });
411
413
  this.#host.setAttribute("data-portaled", "");
412
414
  }
413
415
  #onFocus = (event) => {
@@ -434,9 +436,6 @@ var Portal = class {
434
436
  last ? focusElement(last) : this.#moveFocus("previous");
435
437
  };
436
438
  #onKeyDown = (event) => {
437
- if (!(event instanceof KeyboardEvent)) {
438
- return;
439
- }
440
439
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
441
440
  if (key !== "Tab" || altKey || ctrlKey || metaKey) {
442
441
  return;
package/dist/index.cjs CHANGED
@@ -69,7 +69,9 @@ var Portal = class {
69
69
  for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
70
70
  sentinel.addEventListener("focus", this.#onFocus, { signal });
71
71
  }
72
- this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
72
+ this.#host.addEventListener("keydown", this.#onKeyDown, {
73
+ signal
74
+ });
73
75
  this.#host.setAttribute("data-portaled", "");
74
76
  }
75
77
  #onFocus = (event) => {
@@ -96,9 +98,6 @@ var Portal = class {
96
98
  last ? powerFocusable.focusElement(last) : this.#moveFocus("previous");
97
99
  };
98
100
  #onKeyDown = (event) => {
99
- if (!(event instanceof KeyboardEvent)) {
100
- return;
101
- }
102
101
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
103
102
  if (key !== "Tab" || altKey || ctrlKey || metaKey) {
104
103
  return;
package/dist/index.js CHANGED
@@ -67,7 +67,9 @@ var Portal = class {
67
67
  for (const sentinel of [this.#entranceSentinel, this.#exitSentinel]) {
68
68
  sentinel.addEventListener("focus", this.#onFocus, { signal });
69
69
  }
70
- this.#host.addEventListener("keydown", this.#onKeyDown, { signal });
70
+ this.#host.addEventListener("keydown", this.#onKeyDown, {
71
+ signal
72
+ });
71
73
  this.#host.setAttribute("data-portaled", "");
72
74
  }
73
75
  #onFocus = (event) => {
@@ -94,9 +96,6 @@ var Portal = class {
94
96
  last ? focusElement(last) : this.#moveFocus("previous");
95
97
  };
96
98
  #onKeyDown = (event) => {
97
- if (!(event instanceof KeyboardEvent)) {
98
- return;
99
- }
100
99
  const { key, altKey, ctrlKey, metaKey, shiftKey } = event;
101
100
  if (key !== "Tab" || altKey || ctrlKey || metaKey) {
102
101
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/portal",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Lightweight DOM portal (teleport) utility with fully focus management",
5
5
  "keywords": [
6
6
  "a11y",
@@ -59,6 +59,6 @@
59
59
  },
60
60
  "dependencies": {
61
61
  "@y14e/attribute-utils": "^2.0.15",
62
- "power-focusable": "^4.4.8"
62
+ "power-focusable": "^4.4.10"
63
63
  }
64
64
  }