@y14e/menu 1.5.8 → 1.5.10

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 CHANGED
@@ -10,16 +10,16 @@ npm i @y14e/menu
10
10
 
11
11
  ```ts
12
12
  // npm
13
- import Menu from '@y14e/menu@1.5.8';
13
+ import Menu from '@y14e/menu@1.5.10';
14
14
  // with middleware
15
- import Menu, { flip, offset, shift } from '@y14e/menu@1.5.8';
15
+ import Menu, { flip, offset, shift } from '@y14e/menu@1.5.10';
16
16
 
17
17
  // CDNs
18
- import Menu from 'https://esm.sh/@y14e/menu@1.5.8';
18
+ import Menu from 'https://esm.sh/@y14e/menu@1.5.10';
19
19
  // or
20
- import Menu from 'https://cdn.jsdelivr.net/npm/@y14e/menu@1.5.8/+esm';
20
+ import Menu from 'https://cdn.jsdelivr.net/npm/@y14e/menu@1.5.10/+esm';
21
21
  // or
22
- import Menu from 'https://esm.unpkg.com/@y14e/menu@1.5.8';
22
+ import Menu from 'https://esm.unpkg.com/@y14e/menu@1.5.10';
23
23
  ```
24
24
 
25
25
  ## Usage
package/dist/index.cjs CHANGED
@@ -2927,12 +2927,18 @@ var Menu = class _Menu {
2927
2927
  requestAnimationFrame(() => this.#focusTrigger());
2928
2928
  return;
2929
2929
  }
2930
- if (!["Enter", "Escape", " ", "ArrowLeft", "ArrowRight"].includes(key)) {
2930
+ if (![
2931
+ "Enter",
2932
+ "Escape",
2933
+ " ",
2934
+ ...this.#isSubmenu ? ["ArrowLeft"] : [],
2935
+ ...this.#isMenubar ? ["ArrowLeft", "ArrowRight"] : []
2936
+ ].includes(key)) {
2931
2937
  return;
2932
2938
  }
2933
2939
  event.preventDefault();
2934
2940
  event.stopPropagation();
2935
- if (key === "Escape" || key === "ArrowLeft" && this.#isSubmenu) {
2941
+ if (key === "Escape" || this.#isSubmenu && key === "ArrowLeft") {
2936
2942
  this.close();
2937
2943
  return;
2938
2944
  }
@@ -2947,7 +2953,7 @@ var Menu = class _Menu {
2947
2953
  break;
2948
2954
  case "ArrowLeft":
2949
2955
  case "ArrowRight":
2950
- this.#isMenubar && this.#dispatchTriggerKeyDown(key);
2956
+ this.#dispatchTriggerKeyDown(key);
2951
2957
  break;
2952
2958
  }
2953
2959
  };
@@ -3252,7 +3258,7 @@ function isFocusable3(element) {
3252
3258
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
3253
3259
  * Supports checkbox item, radio item, and infinitely nested menus.
3254
3260
  *
3255
- * @version 1.5.8
3261
+ * @version 1.5.10
3256
3262
  * @author Yusuke Kamiyamane
3257
3263
  * @license MIT
3258
3264
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.cts CHANGED
@@ -6,7 +6,7 @@ export { flip, offset, shift } from '@floating-ui/dom';
6
6
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
7
7
  * Supports checkbox item, radio item, and infinitely nested menus.
8
8
  *
9
- * @version 1.5.8
9
+ * @version 1.5.10
10
10
  * @author Yusuke Kamiyamane
11
11
  * @license MIT
12
12
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export { flip, offset, shift } from '@floating-ui/dom';
6
6
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
7
7
  * Supports checkbox item, radio item, and infinitely nested menus.
8
8
  *
9
- * @version 1.5.8
9
+ * @version 1.5.10
10
10
  * @author Yusuke Kamiyamane
11
11
  * @license MIT
12
12
  * @copyright Copyright (c) Yusuke Kamiyamane
package/dist/index.js CHANGED
@@ -2923,12 +2923,18 @@ var Menu = class _Menu {
2923
2923
  requestAnimationFrame(() => this.#focusTrigger());
2924
2924
  return;
2925
2925
  }
2926
- if (!["Enter", "Escape", " ", "ArrowLeft", "ArrowRight"].includes(key)) {
2926
+ if (![
2927
+ "Enter",
2928
+ "Escape",
2929
+ " ",
2930
+ ...this.#isSubmenu ? ["ArrowLeft"] : [],
2931
+ ...this.#isMenubar ? ["ArrowLeft", "ArrowRight"] : []
2932
+ ].includes(key)) {
2927
2933
  return;
2928
2934
  }
2929
2935
  event.preventDefault();
2930
2936
  event.stopPropagation();
2931
- if (key === "Escape" || key === "ArrowLeft" && this.#isSubmenu) {
2937
+ if (key === "Escape" || this.#isSubmenu && key === "ArrowLeft") {
2932
2938
  this.close();
2933
2939
  return;
2934
2940
  }
@@ -2943,7 +2949,7 @@ var Menu = class _Menu {
2943
2949
  break;
2944
2950
  case "ArrowLeft":
2945
2951
  case "ArrowRight":
2946
- this.#isMenubar && this.#dispatchTriggerKeyDown(key);
2952
+ this.#dispatchTriggerKeyDown(key);
2947
2953
  break;
2948
2954
  }
2949
2955
  };
@@ -3248,7 +3254,7 @@ function isFocusable3(element) {
3248
3254
  * WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript.
3249
3255
  * Supports checkbox item, radio item, and infinitely nested menus.
3250
3256
  *
3251
- * @version 1.5.8
3257
+ * @version 1.5.10
3252
3258
  * @author Yusuke Kamiyamane
3253
3259
  * @license MIT
3254
3260
  * @copyright Copyright (c) Yusuke Kamiyamane
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@y14e/menu",
3
- "version": "1.5.8",
3
+ "version": "1.5.10",
4
4
  "description": "WAI-ARIA compliant menu (menu button) pattern implementation in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",