Uh oh!
There was an error while loading. Please reload this page.
fix(plugin-grid): 批量弹窗里关掉下拉/选人组件时不再连带关掉整个弹窗 (#2185) - #2190
Merged
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
…ct/Popover Opening the Status <Select> (or a ComboBox lookup <Popover>) inside the bulk edit dialog and then clicking away from the dropdown — without picking an option — tore down the entire dialog, not just the dropdown. Root cause: while a nested Radix popper is open it marks the dialog body pointer-events:none but leaves the dialog overlay pointer-events:auto, so a click on the visually-still-there dialog falls through to the backdrop and Radix's DismissableLayer dismisses the whole dialog. The open popper can't be detected from the dialog's onInteractOutside handler because Radix has already unmounted it by the time that runs (present at capture-phase pointerdown, gone by bubble). Snapshot whether a popper was open on the capture-phase pointerdown and guard onPointerDownOutside/onInteractOutside off that snapshot: the first click away just dismisses the dropdown and the dialog stays put; a genuine backdrop click (no popper open) still closes it. (#2185)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
批量编辑弹窗(
BulkActionDialog)里,打开 Status 单选下拉(Radix<Select>)或可搜索的 lookup 选人组件(ComboBox<Popover>)后,不点选项、点弹窗内别处空白,会把整个批量弹窗一起关掉——用户只是想收起下拉,却丢了整个弹窗。#2186(#2185)引入这些控件后暴露出来。根因(实测确认)
下拉/popover 打开时,Radix 把弹窗主体标成
pointer-events:none,却把遮罩层保留为pointer-events:auto。于是点在“视觉上还在的弹窗”上,点击穿透到背后的遮罩 → Radix 的 DismissableLayer 认为是“点了弹窗外面” → 拆掉整个 Dialog。无法在 Dialog 的
onInteractOutside里直接检测“下拉是否开着”:加 capture/bubble 双探针验证——同一次 pointerdown,capture 阶段 popper 还在,到 bubble 阶段 Radix 已经把它卸载了,所以处理器里读实时 DOM 永远读到“没有 popper”。修法
在 capture 阶段的 pointerdown 打一个快照(当时有没有 popper 开着),
onPointerDownOutside/onInteractOutside读这个快照而不是过时的实时 DOM:验证(真实浏览器,CDP 级点击)
<Select>(Reschedule 的 Status):点别处 →dialogStillOpen: true、下拉关闭 ✓<Popover>(Assign Team 的选人):点别处 → 弹窗保留、popover 关闭 ✓bulkActionDialogParams.test.tsx3/3 通过注:此交互依赖 Radix 的 portal +
pointer-events+ DismissableLayer 时序,jsdom 复现不了,未加独立单测——改为真实浏览器验证 + 代码内详注原因。