fix: forward disableFocusManagement from DialogContainer to Modal#10297
Open
momomuchu wants to merge 1 commit into
Open
fix: forward disableFocusManagement from DialogContainer to Modal#10297momomuchu wants to merge 1 commit into
momomuchu 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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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