fix: resolve close policy, handler merging and submenu panel props

- Menu forwards the raw close policy and the item resolves item > menu
  (boolean or function) > per-mode default, so action items close by default and
  an explicit single/multiple policy is no longer pre-empted.
- Root popover chains caller handlers with the internal ones for keydown,
  escape, interact-outside, auto focus and animation end; callers run first and
  a prevented event stops the internal logic.
- Submenu panels receive the nested popover's data/style/id/extra events, honour
  isKeyboardDismissDisabled without closing the parent level or a modal, and
  forward shouldCloseOnInteractOutside.
- A standalone Menu provides its own content-attribute channel so the
  accessible name/description land on the real role=menu node.
This commit is contained in:
maoyingjie
2026-10-24 23:42:05 +08:00
parent 53b4639b0e
commit b474a63303
12 changed files with 465 additions and 54 deletions
@@ -136,13 +136,13 @@ export default defineComponent({
});
function shouldClose() {
// Priority: item policy -> menu policy -> per-mode default.
if (props.closeOnSelect !== undefined) return props.closeOnSelect;
const menuPolicy = menuCtx?.shouldCloseOnSelect.value;
if (typeof menuPolicy === "function") return menuPolicy(key.value);
// Default per mode: action and radio items close, checkboxes stay open.
if (selectionMode.value !== "none")
return selectionMode.value === "single";
return menuPolicy ?? true;
if (typeof menuPolicy === "boolean") return menuPolicy;
// Default: action and radio items close, checkboxes stay open.
return selectionMode.value !== "multiple";
}
function activate() {