fix: align Dropdown/Menu with the HeroUI baseline after fidelity audit
- menu-item.css keys disabled styling off the presence attribute Reka emits. - Dropdown surfaces drive the ported enter/exit animations and use data-side for placement-specific motion. - One role=menu per popup; items render their key as DOM id; submenu surfaces point aria-labelledby at the real trigger; MenuSection names its group from a nested Header. - Custom (asChild) triggers stay keyboard focusable; library Button/Avatar keep their own layout instead of the custom-trigger rules. - Items emit data-focused/data-hovered/data-pressed, expose the upstream render props to slots, and merge caller classes through tailwind-variants. - Submenu triggers declare hasSubmenu explicitly and forward class/ARIA; the default submenu indicator uses the baseline chevron artwork. - Demos restore Kbd slot="keyboard" (27x), IconSquarePlus, and remove the added comment, stray space and duplicated indicator SVGs. - Document the page after the official structure and API tables, including renamed props, Vue extensions and remaining gaps.
This commit is contained in:
@@ -58,21 +58,29 @@ export default defineComponent({
|
||||
const attrs = useAttrs();
|
||||
const item = inject(menuItemContextKey, null);
|
||||
return () => {
|
||||
const isSelected = item?.isSelected.value ?? false;
|
||||
const state = {
|
||||
isSelected: item?.isSelected.value ?? false,
|
||||
// Menu items have no indeterminate state; kept for the upstream
|
||||
// render-prop contract.
|
||||
isIndeterminate: false,
|
||||
isFocused: item?.isFocused.value ?? false,
|
||||
isDisabled: item?.isDisabled.value ?? false,
|
||||
isPressed: item?.isPressed.value ?? false,
|
||||
};
|
||||
const content = slots.default
|
||||
? slots.default({ isSelected })
|
||||
? slots.default(state)
|
||||
: props.type === "dot"
|
||||
? DotIcon()
|
||||
: CheckmarkIcon(isSelected);
|
||||
: CheckmarkIcon(state.isSelected);
|
||||
return h(
|
||||
props.as,
|
||||
{
|
||||
...attrs,
|
||||
"aria-hidden": "true",
|
||||
class: [item?.slots.value.indicator(), attrs.class],
|
||||
class: item?.slots.value.indicator({ class: attrs.class as never }),
|
||||
"data-slot": "menu-item-indicator",
|
||||
"data-type": props.type,
|
||||
"data-visible": isSelected || undefined,
|
||||
"data-visible": state.isSelected || undefined,
|
||||
},
|
||||
content,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user