fix: portal dropdown surfaces and close the review capability gaps
- Root and submenu surfaces render through the dropdown portal with the overlay z-index, so clipping/isolation ancestors no longer cut the menu; panel height is capped by the floating available height and the animation origin maps the real transform origin. - Standalone Menu is a static in-flow list: no scroll lock, no outside pointer blocking, no floating placement and no focus stealing. - Selection ownership is isolated per level: section disabled keys add to the menu list, and a nested Menu resets the section owner. - closeOnSelect resolves item > menu policy > per-mode default for selection items; actions and radio items close, checkboxes stay open. - Business keys no longer become DOM ids (instance ids + data-key), and submenu surfaces label themselves from the real trigger. - Long-press keydown runs the caller's handlers first and only opens when not cancelled; submenu panels merge caller keydown with the internal Escape. - Link items render a real anchor, aria labels land on the role=menu node, submenu panels forward placement/offset/collision props and caller attrs, and the popover provides the default Surface variant. - Wrapper parts declare real props/emits, plus the missing official capability props (disallowEmptySelection, escapeKeyBehavior, shouldFocusWrap, autoFocus, shouldCloseOnSelect, close, empty slot, isKeyboardDismissDisabled, shouldCloseOnInteractOutside, placement/offset family, scoped slots). - Ship an independent consumer fixture for browser-level verification.
This commit is contained in:
@@ -42,6 +42,8 @@ export default defineComponent({
|
||||
type: Array as PropType<ReadonlyArray<MenuKey>>,
|
||||
default: () => [],
|
||||
},
|
||||
/** Clear the last selection when the user deselects it. */
|
||||
disallowEmptySelection: { type: Boolean, default: false },
|
||||
},
|
||||
emits: {
|
||||
"update:selectedKeys": (_keys: MenuKey[]) => true,
|
||||
@@ -68,6 +70,7 @@ export default defineComponent({
|
||||
selectionMode: effectiveMode,
|
||||
selectedKeys: acceptedKeys,
|
||||
disabledKeys: computed(() => props.disabledKeys ?? []),
|
||||
disallowEmptySelection: computed(() => props.disallowEmptySelection),
|
||||
onSelectionChange(next) {
|
||||
if (!isControlled.value) internal.value = next;
|
||||
emit("update:selectedKeys", next);
|
||||
@@ -121,11 +124,11 @@ export default defineComponent({
|
||||
? sectionSelection
|
||||
: (menuCtx?.selection ?? sectionSelection)
|
||||
).isItemSelected(key),
|
||||
// Disabled keys are additive: the section list never overrides the
|
||||
// menu list, whichever side owns the selection.
|
||||
isItemDisabled: (key: MenuKey) =>
|
||||
(ownsSelection.value
|
||||
? sectionSelection
|
||||
: (menuCtx?.selection ?? sectionSelection)
|
||||
).isItemDisabled(key),
|
||||
(props.disabledKeys ?? []).some((item) => item === key) ||
|
||||
(menuCtx?.selection.isItemDisabled(key) ?? false),
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user