`@effect/ui-kit` (Effect-TS/ui): `Dialog` / `Drawer` cannot dismiss via `backdrop` click or `<dialog>` `cancel` when `runsMounts: false`

オープン
#11,059 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@effect-bot がすでに取り組んでいます。

2026年11月29日 から。

  • #626 @effect-bot による — オープン

評価

この issue はまだ評価されていません。

説明

What version of Effect is running?
  • effect: 4.1.6
  • @effect/ui & @effect/ui-kit: Effect-TS/ui main at 77391ee50ae3d3175d670facbf675e9a819ba6a6
What steps can reproduce the bug?
  1. 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
    
  2. Render an open Dialog (or Drawer) on TestHost (which sets runsMounts: false, matching any non-DOM host that disables browser-DOM mounts) and either:
    • click dialog.backdrop, or
    • fire the native <dialog> cancel event on dialog.portal.

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分
マージ済み PR(30日)
486

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Effect-TS/effect のほかの issue

Effect-TS/effect の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。