`@effect/ui-kit` (Effect-TS/ui): `portalBox` appends `width:0;height:0` after consumer inline style and cannot be overridden

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

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

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

2026年11月29日 から。

  • #623 @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 a Dialog with open: true (default topLayer: true) and supply an explicit inline style on dialog.portal:
dialog.portal(
  h.dialog.attr("style", "width:100%;height:100%")
)?.children(
  dialog.popup(h.div).children(
    dialog.title(h.h2).children("Modal"),
    dialog.close(h.button).children("Tap Me")
  )
)
  1. Inspect the emitted style attribute on <dialog> (see 03-dialog-portalbox-overrides-consumer-style/repro.test.ts).
What is the expected behavior?

Consumer-provided sizing (width/height) on dialog.portal (or a host/stylesheet override) should be able to override the default portalBox reset rather than being unconditionally clobbered by trailing inline width:0;height:0;.

What do you see instead?

packages/ui-kit/src/internal/topLayer.ts:55 defines:

export const portalBox =
  "position:fixed;inset:0;width:0;height:0;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:visible;background:transparent;color:inherit"

And Dialog (packages/ui-kit/src/Dialog.ts:1361-1364, also used by Drawer) — as well as PreviewCard (1247-1250) and NavigationMenu (911-915) — applies it via withStyle(node.elementAttrs.style, portalBox) (packages/ui-kit/src/internal/attributes.ts:10-13), which appends portalBox after the consumer's style:

style="width:100%;height:100%;position:fixed;inset:0;width:0;height:0;max-width:none;max-height:none;margin:0;padding:0;border:0;overflow:visible;background:transparent;color:inherit"

Because width:0;height:0 appears last in the inline style attribute, the winning declarations are width: 0 and height: 0:

AssertionError: expected '0' to equal '100%'
Additional information

Why this matters in practice:

  • In browsers, overflow:visible allows position:fixed descendants outside a 0×0 <dialog> box to remain clickable.
  • On non-browser layout engines rendering the Html vocabulary (for example iOS UIKit + Taffy via ns-effect-ui's MasonHost), UIView.hitTest(_:with:) rejects touches outside a 0×0 ancestor view frame even when clipsToBounds = false allows its children to render visibly.
  • Because portalBox is appended last as an inline style, neither stylesheets nor consumer .attr("style", "width:100%;height:100%") can override it, and passing topLayer: false is not an equivalent escape hatch because it changes modal/layering semantics.

Even prepending portalBox as defaults (so consumer inline styles win) or only emitting the reset declarations not already specified by the consumer would allow non-browser hosts and apps to size the portal container without breaking browser defaults.

主要言語
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 を短くまとめたダイジェスト。