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:
maoyingjie
2026-10-24 22:14:10 +08:00
parent 64aaf5e53f
commit 043a5418f3
27 changed files with 1124 additions and 254 deletions
@@ -32,21 +32,21 @@ const textAlignment = ref<MenuKey[]>(["left"]);
<Header>操作</Header>
<DropdownItem id="cut" text-value="剪切">
<Label>剪切</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="command" />
<KbdContent>X</KbdContent>
</Kbd>
</DropdownItem>
<DropdownItem id="copy" text-value="复制">
<Label>复制</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="command" />
<KbdContent>C</KbdContent>
</Kbd>
</DropdownItem>
<DropdownItem id="paste" text-value="粘贴">
<Label>粘贴</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="command" />
<KbdContent>U</KbdContent>
</Kbd>
@@ -62,7 +62,7 @@ const textAlignment = ref<MenuKey[]>(["left"]);
<DropdownItem id="bold" text-value="粗体">
<DropdownItemIndicator />
<Label>粗体</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="command" />
<KbdContent>B</KbdContent>
</Kbd>
@@ -70,7 +70,7 @@ const textAlignment = ref<MenuKey[]>(["left"]);
<DropdownItem id="italic" text-value="斜体">
<DropdownItemIndicator />
<Label>斜体</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="command" />
<KbdContent>I</KbdContent>
</Kbd>
@@ -78,7 +78,7 @@ const textAlignment = ref<MenuKey[]>(["left"]);
<DropdownItem id="underline" text-value="下划线">
<DropdownItemIndicator />
<Label>下划线</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="command" />
<KbdContent>U</KbdContent>
</Kbd>
@@ -94,7 +94,7 @@ const textAlignment = ref<MenuKey[]>(["left"]);
<DropdownItem id="left" text-value="左对齐">
<DropdownItemIndicator type="dot" />
<Label>左对齐</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="alt" />
<KbdContent>A</KbdContent>
</Kbd>
@@ -102,7 +102,7 @@ const textAlignment = ref<MenuKey[]>(["left"]);
<DropdownItem id="center" text-value="居中">
<DropdownItemIndicator type="dot" />
<Label>居中</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="alt" />
<KbdContent>H</KbdContent>
</Kbd>
@@ -110,7 +110,7 @@ const textAlignment = ref<MenuKey[]>(["left"]);
<DropdownItem id="right" text-value="右对齐">
<DropdownItemIndicator type="dot" />
<Label>右对齐</Label>
<Kbd class="ms-auto" variant="light">
<Kbd class="ms-auto" slot="keyboard" variant="light">
<KbdAbbr key-value="alt" />
<KbdContent>D</KbdContent>
</Kbd>