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:
maoyingjie
2026-10-24 22:56:44 +08:00
parent 043a5418f3
commit 53b4639b0e
25 changed files with 1721 additions and 203 deletions
+29
View File
@@ -0,0 +1,29 @@
# B01 独立浏览器消费夹具
用打包产物(`pnpm pack` 生成的 `@heroui-vue/components` / `@heroui-vue/styles` tarball)在独立 Vue 应用中真实挂载,覆盖:
- `selection`:带 `contain/isolation/overflow:hidden` 祖先的分组级多选长菜单(验证 Portal 脱离裁切、高度上限、真实 `role="menu"` 名称)。
- `submenu`:三级子菜单 + 链接型菜单项。
- `modal`:Modal 内的 Dropdown(验证层级与关闭顺序、滚动锁释放)。
- `standalone`:独立 `Menu` 内联列表(无滚动锁、无浮动定位、不抢焦点)。
## 使用方式
```bash
# 1. 在库仓库打包
pnpm build
pnpm --filter @heroui-vue/styles exec pnpm pack --pack-destination /tmp/heroui-b01-consumer
pnpm --filter @heroui-vue/components exec pnpm pack --pack-destination /tmp/heroui-b01-consumer
# 2. 复制本目录到消费工程并安装
cp -R tests/package/b01-consumer-app/. /tmp/heroui-b01-consumer/app/
cd /tmp/heroui-b01-consumer && pnpm install
# 3. 打包成静态产物(esbuild 只作为构建工具,运行期仅依赖 tarball)
esbuild app/main.js --bundle --format=esm --outfile=app/bundle.js --loader:.css=css
# 4. 静态服务后打开(`?only=selection|submenu|modal|standalone` 可单例)
python3 -m http.server 5199 --bind 127.0.0.1 --directory app
```
`consume-b01-menu-dropdown.mjs` 只做导出/CSS 存在性检查;真实挂载行为以本夹具的浏览器结果为准。