fix: forward disableFocusManagement from DialogContainer to Modal#10297
fix: forward disableFocusManagement from DialogContainer to Modal#10297momomuchu wants to merge 1 commit into
Conversation
DialogContainer accepted isDismissable and isKeyboardDismissDisabled and forwarded them to the underlying Modal, but silently dropped disableFocusManagement: it was not destructured, not declared on SpectrumDialogContainerProps, and not passed to <Modal>. Modal (via Overlay's disableFocusManagement prop, spread through to react-aria's Overlay) already supports it end-to-end, so this was purely a missing forward in DialogContainer. Add disableFocusManagement to SpectrumDialogContainerProps, destructure it, and forward it to Modal. Added a regression test asserting that with disableFocusManagement set, FocusScope's restoreFocus is skipped so focus is not automatically restored to the trigger after the dialog closes (unlike the default behavior). Verified RED before the fix (prop silently ignored, so disableFocusManagement behaved identically to default) and GREEN after. Fixes adobe#10280
2f53b38 to
86883bf
Compare
|
I don't think we intend to expose this because is breaks the accessibility of dialogs. What are you trying to achieve? |
|
Use case is in #10280: an embedding host renders its own dialog shell and manages focus itself, passing
Is forwarding the existing prop acceptable, or would you rather scope this to something narrower? |
DialogContaineraccepteddisableFocusManagementin name only: it was not on the prop type, not destructured, and not forwarded toModal(which already supports it), so setting it did nothing.This adds it to
SpectrumDialogContainerProps, destructures it, and forwards it toModal.The test asserts that with
disableFocusManagementset, focus is not restored to the trigger on close (the observable effect of the prop). It fails without the fix and passes with it. Dialog suites green, monorepo typecheck clean.Closes #10280