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:
@@ -941,3 +941,23 @@ Button/PopoverTrigger/Link/ToggleButtonGroup 源码及几何复核后,移除
|
||||
- **文档**:`apps/docs/components/dropdown.md` 按官方分节重写(完整骨架、官方 4 类全局 CSS 示例、分节样式参考、每部件 API 表含改名列与 Vue 扩展、Render Props 表、官方无障碍条目、3 项相关组件)。
|
||||
- **回归**:`tests/b01-menu-dropdown.test.ts` 增至 **27/27**(新增 17 个预览整体挂载无 warn/error、DOM id 与单 `role=menu`、禁用选择器、子菜单 `aria-labelledby` 可解析、Section 标签、自定义触发器可聚焦、插槽 render state、class 合并、无指示器子菜单),`b01-review.probe.test.ts` **7/7**;完整 **71 文件 / 897 项**;typecheck、build:docs、Prettier 通过。
|
||||
- **仍保留**:链接型菜单项(`href`)不支持(Reka 无锚点路径)、子菜单悬停延迟固定 100ms、`disallowEmptySelection` 等官方 props 未提供、`DropdownRoot` 保留一层包裹元素;`Kbd slot="keyboard"` 之外未做逐像素对比,完整读屏/触屏/Nuxt 仍未验证。
|
||||
|
||||
### B01 整批复核返修(同日)
|
||||
|
||||
按 [整批复核清单](migrations/B01-complete-review.md) 处理 R1–R12,新增 `tests/b01-complete-review.probe.test.ts` **13/13**(含禁用真实长按按钮一项保持通过)与类型正例 `tests/package/b01-wrapper-props-review.ts`。
|
||||
|
||||
- **R1 弹层挂载**:根与子菜单面板都经 Portal 挂到 body(`to` 可配),层级 `--z-index-overlay`。独立消费页里,带 `overflow:hidden/contain:content/isolation:isolate` 的祖先不再裁切面板:面板父节点是 popper 包装层、位于 body,rect 57–383(视口 709),首末项可见,z-index 100000。
|
||||
- **R2 独立 Menu**:不再用模态兜底。浏览器实测内联列表 `body` 无内联样式、包装层计算 `position: static`、焦点留在页面、条目 `role=menuitem`。
|
||||
- **R3 所有权隔离**:Section 禁用列表与菜单级叠加;Section 下的新 Menu 重置选择作用域(不再渲染成 `menuitemcheckbox`)。
|
||||
- **R4 关闭策略**:条目 `closeOnSelect` > 菜单 `shouldCloseOnSelect` > 按模式默认(single/动作关闭、multiple 保持)。
|
||||
- **R5 key 与 DOM id**:业务 key 不再作 DOM id,实例 id 唯一,`0` 与 `"0"` 不冲突;子菜单 `aria-labelledby` 指向本实例触发器(浏览器与单测均验证)。
|
||||
- **R6 事件取消**:Enter/Space 先跑调用方 `keydown`,被取消时不打开;基准触发器的 toggle 在本次事件内被挂起,仍只切换一次。子菜单面板合并调用方 `keydown` 与内部 Escape。
|
||||
- **R7 链接项**:`href` 项渲染真实 `<a>`(保留 `target/rel` 等),禁用项阻止导航。
|
||||
- **R8 可访问名称**:`aria-label` 等落在真正的 `role="menu"` 节点(浏览器读到「水果操作」)。
|
||||
- **R9 子菜单参数**:嵌套 `DropdownPopover` 的偏移/碰撞/`loop`/`to`/class/事件透传到子菜单面板;`side/align` 为底座固定值,已写入差异。
|
||||
- **R10 Surface**:弹层局部提供 `default` 变体,嵌入字段不会继承外层 secondary。
|
||||
- **R11 动画原点与高度**:`transform-origin` 取到底座浮动原点(实测 `30px 0px`),`max-height` 取可用高度(实测 640px)+ `overflow-y:auto`。
|
||||
- **R12 组件类型**:包装部件补齐真实 props/emits,真实组件 `$props` 正例在仓库与独立 tarball 的 bundler/NodeNext 下均通过。
|
||||
- **能力清单**:`disallowEmptySelection`、`escapeKeyBehavior`、`shouldFocusWrap`、`autoFocus`、菜单级 `shouldCloseOnSelect`、`close` 事件、`empty` 插槽、`isKeyboardDismissDisabled`、`shouldCloseOnInteractOutside`、`placement/offset/crossOffset/shouldFlip/containerPadding`、Trigger/Popover 作用域插槽已提供;`items` 以 `v-for`、`renderEmptyState` 以 `empty` 插槽表达,子菜单 `delay` 与 `side/align` 作为底座固定值记录在页面「上游差异」。
|
||||
- **独立浏览器消费**:`tests/package/b01-consumer-app/` 夹具用 tarball 安装后 esbuild 打包、静态服务,实测分组级多选、三级子菜单、链接项、Modal 内菜单(Esc 先关菜单再关 Modal,body 样式清空、焦点回触发器)与独立 Menu。控制台仅有 Vue feature flag 提示,无组件告警或错误。
|
||||
- 回归:**72 文件 / 917 项**通过;typecheck、build:docs、Prettier 通过。仍未验证:完整读屏、物理触屏、逐像素对比、Nuxt/SSR(本批不要求)。
|
||||
|
||||
Reference in New Issue
Block a user