`@effect/ui-kit` (Effect-TS/ui): `Dialog` / `Drawer` cannot dismiss via `backdrop` click or `<dialog>` `cancel` when `runsMounts: false`
维护者通常 1 天内回复
评估
这个 Issue 还没有评估数据。
描述
What version of Effect is running?
effect:4.1.6@effect/ui&@effect/ui-kit:Effect-TS/uimainat77391ee50ae3d3175d670facbf675e9a819ba6a6
What steps can reproduce the bug?
- Clone the minimal reproduction branch:
git clone -b repros/non-dom-host-uikit-bugs https://github.com/cliffordfajardo/ui.git effect-ui-repro cd effect-ui-repro pnpm install pnpm repro:test - Render an open
Dialog(orDrawer) onTestHost(which setsrunsMounts: false, matching any non-DOM host that disables browser-DOM mounts) and either:- click
dialog.backdrop, or - fire the native
<dialog>cancelevent ondialog.portal.
- click
Minimal repro (see 02-dialog-drawer-no-backdrop-or-cancel-without-mounts/repro.test.ts):
const play = yield* HtmlPlay.make(DialogApp, {})
assert.strictEqual(play.root.model()?.open, true)
// 1. Click dialog.backdrop
yield* play.click(Locator.attr("class", "backdrop"))
assert.strictEqual(play.root.model()?.open, false)
// 2. Dispatch native cancel on <dialog>
yield* play.fire(Locator.tag("dialog"), "cancel", {})
assert.strictEqual(play.root.model()?.open, false)
What is the expected behavior?
When disablePointerDismissal is not true, clicking dialog.backdrop should emit RequestedClose (e.g. with reason "outside-press"), and dispatching cancel on the <dialog> portal should emit RequestedClose (e.g. with reason "escape-key"), even when runsMounts: false (such as in HtmlPlay on TestHost or on a non-DOM Html host).
What do you see instead?
Neither backdropPart (packages/ui-kit/src/Dialog.ts:1408-1419) nor portalPart (packages/ui-kit/src/Dialog.ts:1349-1397) attaches a declarative event handler — both outside-press dismissal and close-watcher/escape dismissal live exclusively inside the browser-DOM TrackDialog mount.
In HtmlPlay on TestHost:
Error: HtmlPlay.click: nothing handles "click" at [class="backdrop"]
and:
Error: HtmlPlay.fire: nothing handles "cancel" at <dialog>
Additional information
Encountered while running @effect/ui-kit's Dialog and Drawer on a non-DOM Html host (ns-effect-ui's MasonHost) with runsMounts: false, where the only working dismissal path without patching or wrapping backdrop was clicking an explicit dialog.close(...) button.
Adding declarative .on("click", ...) on backdropPart (respecting disablePointerDismissal and deduplicating with TrackDialog when mounts run) and .on("cancel", ...) on portalPart would make Dialog and Drawer dismissal work consistently in HtmlPlay/TestHost tests as well as on non-DOM Html hosts.
- 主要语言
- TypeScript
- 星标
- 16.7k
- 派生
- 808
- 平均合并
- 21 小时 22 分钟
- 30 天内合并 PR
- 486
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Effect-TS/effect 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing components可能已有人在做 @effect-bot 今天认领。 未关闭
Effect-TS/effect#11097 · 已指派 1 人 ·
维护者通常 1 天内回复
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`可能已有人在做 @effect-bot 今天认领。 未关闭
Effect-TS/effect#11096 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
check:failed streams:edit
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
[Bug]: Critical path skips a child span that ends exactly when the next one starts可能已有人在做 @Piyush4801 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
jaegertracing/jaeger-ui#4865 · 1 条评论 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复