`@effect/ui-kit` (Effect-TS/ui): `Dialog` / `Drawer` cannot dismiss via `backdrop` click or `<dialog>` `cancel` when `runsMounts: false`
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
Issue này chưa được đánh giá.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 16.7k
- Fork
- 808
- Merge trung bình
- 21 giờ 22 phút
- Pull request đã merge (30 ngày)
- 486
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Effect-TS/effect
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): `kit/VirtualList` `list` part widens `R` to `any`, poisoning enclosing componentsCó thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11097 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`@effect/ui-native` (Effect-TS/ui): Controlled `input` rejected-edit restore never calls `host.commit()`Có thể đã có người làm @effect-bot đã nhận hôm nay. Đang mở
Effect-TS/effect#11096 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Effect-TS/effect
Issue tương tự
-
check:failed streams:edit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
iptv-org/iptv#60585 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Critical path skips a child span that ends exactly when the next one startsCó thể đã có người làm @Piyush4801 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
jaegertracing/jaeger-ui#4865 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
anthropics/claude-code#112972 ·
-
Type: Improvement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày