Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix opening modals from other modals. #2263

Merged
merged 2 commits into from
Sep 24, 2020
Merged

Conversation

askvortsov1
Copy link
Member

DO NOT MERGE WHEN APPROVED, REROUTE TO MASTER AFTER THE REWRITE IS MERGED

While seemingly correct, an onremove method in Modal that triggers animateHide is problematic, because if one modal is opened from another, the one currently open will be removed from the DOM, triggering animateHide, and closing the new modal.

To compensate, an onupdate method now closes a modal if one is open but shouldn't be; this supports the functionality of the old method when the modal is closed not from the modal instance itself (e.g. app.modal.close())

This is not ideal, but necessary. We should consider eventually expanding the modal system to support showing multiple modals at the same time (stacked over each other). Then, we can move this back to individual modals.

Copy link
Member

@clarkwinkelmann clarkwinkelmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good then!

@dsevillamartin dsevillamartin mentioned this pull request Sep 4, 2020
65 tasks
franzliedke pushed a commit that referenced this pull request Sep 18, 2020
Base automatically changed from mithril-2-update to master September 24, 2020 02:40
While seemingly correct, an onremove method in Modal that triggers animateHide is problematic, because if one modal is opened from another, the one currently open will be removed from the DOM, triggering animateHide, and closing the new modal.

To compensate, an onupdate method now closes a modal if one is open but shouldn't be; this supports the functionality of the old method when the modal is closed not from the modal instance itself (e.g. app.modal.close())

This is not ideal, but necessary. We should consider eventually expanding the modal system to support showing multiple modals at the same time (stacked over each other). Then, we can move this back to individual modals.
@askvortsov1 askvortsov1 merged commit 5b157f0 into master Sep 24, 2020
@askvortsov1 askvortsov1 deleted the mithril-2-modal-fix branch September 24, 2020 03:12
askvortsov1 added a commit that referenced this pull request Sep 25, 2020
askvortsov1 added a commit that referenced this pull request Sep 25, 2020
askvortsov1 added a commit that referenced this pull request Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants