harbor run -t scale-ai/hil-bench-swe_67-ask_humanharbor download scale-ai/hil-bench-swe_67-ask_humanModalTwo dialog behaviorWhen ModalTwo is exercised in a constrained DOM implementation such as JSDOM, the modal host does not behave the same way it does in a browser. Descendant semantics, DOM traversal, and interaction checks can diverge from browser behavior, which makes tests around open modal content unreliable.
The fix must preserve the current ModalTwo consumer surface and should not require modal callers to adopt a different API. Compatibility for constrained environments may be achieved either inside the abstraction itself or by substituting that abstraction through the project's environment-specific integration hooks, so long as consumers keep using the same Dialog-level contract.
Automated tests around ModalTwo are unstable in non-browser environments, and developers receive false negatives during CI and local runs.
Render <ModalTwo open> in a constrained DOM test environment.
Include an interactive descendant in the modal body.
Query or interact with that content using standard Testing Library semantics.
Observe that the content is not exposed consistently enough to match browser behavior.
Open modal content should remain testable and operable in constrained DOM environments without requiring callers to mount a different host directly or rewrite individual modal tests. The production-facing Dialog abstraction should keep its existing consumer contract, while the constrained-environment compatibility path should preserve equivalent observable behavior for ModalTwo.
The current ModalTwo implementation depends directly on browser dialog behavior, and constrained DOM environments do not expose that behavior consistently enough for the existing tests and hooks.
The UI should expose a Dialog abstraction that production callers use instead of mounting a host element directly.
The production Dialog abstraction should continue to model a native dialog wrapper for consumers.
Compatibility for constrained DOM environments may be provided either inside the Dialog abstraction or by substituting that abstraction through the project's environment-specific integration points, for example via runtime capability detection, shared bootstrap substitution, or module-level replacement, as long as consumer code does not change.
Any constrained-environment implementation or substitute must preserve the same public import shape and ref-forwarding semantics that existing ModalTwo integrations expect, including compatibility with the current default-import usage pattern.
Dialog should provide a reference to the actual rendered host element rather than an adapter or imperative proxy, while callers should still be able to use standard dialog operations whenever the rendered host genuinely supports them.
Dialog should accept and forward standard HTMLDialogElement attributes and any aria-* or data-* attributes to the host chosen for that environment.
Dialog should render its children unchanged so that interactive descendants retain their roles, semantics, and tab order.
ModalTwo should depend on the Dialog abstraction for its container and should not mount a platform-specific host directly.
The constrained-environment compatibility path should keep open modal descendants discoverable through standard Testing Library semantics and should not require per-test consumer rewrites.
If the environment-substitution path is used, the supported package-level integration point is the shared Jest bootstrap at packages/components/jest.setup.js, and the substituted module is packages/components/components/dialog/Dialog.tsx. The substitution must be installed before ModalTwo imports are evaluated.
Path: packages/components/components/dialog/Dialog.tsx
Name: Dialog (default export from new file)
Type: function
Input: props: HTMLAttributes<HTMLDialogElement>, ref: Ref<HTMLDialogElement>
Output: JSX.Element
Description: Provides a reusable dialog component that forwards a ref and accepts standard HTML dialog attributes.