Repository navigation
fix(Overlay): let a controller on the overlay dismiss it - #1335
Merged
Merged
Conversation
The overlay instance copied parentOptions before the overlay computed its dismiss, so this.instance.parentOptions.dismiss was undefined for a controller attached to the Window itself. The overlay now also gives its own instance the options it pushes for its children. Fixes #1332.
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.
Fixes #1332.
Problem
A controller attached to a
Window(or any overlay) could not close it:The same controller worked when attached to an element inside the window.
Instance.explorecopiescontext.parentOptionsonto the instance before the widget's ownexploreruns.Overlay.explorecomputesdismissand pushes it for its children only after that, so the overlay's own instance never received it.Change
Overlay.explorenow assigns the options object it pushes for its children to its own instance as well, so the overlay and its content see the samedismiss. Only the overlay's own instance changes;Button(dismiss) andMsgBox, the other readers ofparentOptions, read it on instances inside the overlay.Tests
New
Window.spec.tsxrenders an inline window and callsdismiss()from a controller attached to the window and from one inside it, checking that the boundvisiblebecomesfalse. The first case failed before the change.yarn workspace cx run test: 537 passing, 2 pending, 0 failingyarn workspace cx run check-types: no errors