Skip to content

Modal flips isOpen from uncontrolled to controlled between its prop and controller paths #3026

Description

@mfal

Modal.browser.test.tsx emits WARN: A component changed from uncontrolled to controlled nine times. isOpen goes undefined → defined as the component moves between the prop-driven and the controller-driven path, and react-aria's useControlledState warns on that transition.

Same class as the Tabs defect fixed in #3025, and probably the same shape of fix — useControlledState treats only undefined as uncontrolled, so passing null for "controlled, nothing open yet" keeps the component on one side of the line. But Modal has two independent ways to drive its open state, so the correct default is a judgement call rather than a mechanical swap, and it deserves its own look.

Provenance

Found while fixing #3014 and verified pre-existing: the count is identical with the #3025 changes reverted. It was not among the 8 + 14 occurrences in #3014's reproduction list — those all traced to Tabs and ModalTrigger — so it was deliberately left out of that PR rather than folded in.

Reproducing

pnpm nx test:browser components --browser.name=webkit

and read the Modal.browser.test.tsx output; the warning appears nine times.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions