@agencecinq/disclosure-navigation 1.0.0 → 2.0.0
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 +11 -1
- package/dist/disclosure-navigation.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,9 @@ if you lay it out.
|
|
|
104
104
|
A submenu can hold buttons with their own submenus. Opening one keeps its parents open
|
|
105
105
|
and closes the other branches. Closing a submenu closes the ones nested in it.
|
|
106
106
|
|
|
107
|
+
In a submenu, the arrow keys stay at its level, whatever the layout: Tab moves into a
|
|
108
|
+
nested submenu, and Escape back to its button.
|
|
109
|
+
|
|
107
110
|
### Opening on hover
|
|
108
111
|
|
|
109
112
|
With `data-hover`, a mouse opens a submenu when it enters its button, and closes it when
|
|
@@ -148,7 +151,7 @@ canceling `beforetoggle` leaves the button collapsed next to a visible submenu.
|
|
|
148
151
|
| Escape | Button or top-level link | Closes the open submenu. |
|
|
149
152
|
| Escape | Submenu | Closes the innermost one and focuses its button. |
|
|
150
153
|
| Escape | Outside the navigation | Closes the open submenu, focus stays. |
|
|
151
|
-
| ArrowDown | Expanded
|
|
154
|
+
| ArrowDown | Expanded top-level button | Moves focus to the first item of its submenu. |
|
|
152
155
|
| Arrow keys | Top-level item | Previous or next button or link, wrapping. |
|
|
153
156
|
| Arrow keys | Submenu item | Previous or next item, wrapping. |
|
|
154
157
|
| Home / End | Top-level or submenu item | First or last item. |
|
|
@@ -261,6 +264,13 @@ Safari 26.2. Elsewhere it acts as `hidden`. The package is an ES module.
|
|
|
261
264
|
|
|
262
265
|
## Migration
|
|
263
266
|
|
|
267
|
+
### From 1.x to 2.0
|
|
268
|
+
|
|
269
|
+
1. **Expect ArrowDown to stay at the level of a submenu.** On an expanded button in a
|
|
270
|
+
submenu, it moved into the nested submenu, while ArrowUp went to the previous item.
|
|
271
|
+
It now goes to the next item. Tab still moves into the nested submenu. ArrowDown on
|
|
272
|
+
an expanded top-level button moves into its submenu, as before.
|
|
273
|
+
|
|
264
274
|
### From `@19h47/disclosure-navigation` 5.x
|
|
265
275
|
|
|
266
276
|
The class becomes a custom element: the host replaces `$nav`. Markup inside it, styles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure-navigation.d.ts","sourceRoot":"","sources":["../src/disclosure-navigation.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;;IAOnD,iBAAiB,IAAI,IAAI;IAIzB,oBAAoB,IAAI,IAAI;IAI5B,gEAAgE;IAChE,IAAI,IAAI,IAAI;IAcZ,gEAAgE;IAChE,OAAO,IAAI,IAAI;IAKf;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IActC,wFAAwF;IACxF,KAAK,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAUxC,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;
|
|
1
|
+
{"version":3,"file":"disclosure-navigation.d.ts","sourceRoot":"","sources":["../src/disclosure-navigation.ts"],"names":[],"mappings":"AA2BA;;;;;;;;;;GAUG;AACH,qBAAa,oBAAqB,SAAQ,WAAW;;IAOnD,iBAAiB,IAAI,IAAI;IAIzB,oBAAoB,IAAI,IAAI;IAI5B,gEAAgE;IAChE,IAAI,IAAI,IAAI;IAcZ,gEAAgE;IAChE,OAAO,IAAI,IAAI;IAKf;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;IActC,wFAAwF;IACxF,KAAK,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI;IAUxC,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,IAAI;CAoOzC"}
|
package/dist/index.js
CHANGED
|
@@ -117,7 +117,7 @@ var e = (e) => e === "open" ? "closed" : "open", t = /* @__PURE__ */ new WeakMap
|
|
|
117
117
|
#h = (e) => {
|
|
118
118
|
if (this.dataset.arrowKeys === "false") return;
|
|
119
119
|
let t = e.target, n = this.#i.findLast((e) => u(e, t)), r = n ? this.#a(l(n), s) : this.#a([this], o), a = r.indexOf(t);
|
|
120
|
-
if (a !== -1) return e.key === "ArrowDown" && t instanceof HTMLButtonElement && c(t) ? (e.preventDefault(), this.#a(l(t), s)[0]?.focus()) : i(e, r, a);
|
|
120
|
+
if (a !== -1) return !n && e.key === "ArrowDown" && t instanceof HTMLButtonElement && c(t) ? (e.preventDefault(), this.#a(l(t), s)[0]?.focus()) : i(e, r, a);
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
123
|
customElements.get("cinq-disclosure-navigation") || customElements.define("cinq-disclosure-navigation", p);
|
package/package.json
CHANGED