fix(Modal): unmounting nested modals#321
Merged
eddywashere merged 1 commit intoreactstrap:masterfrom Feb 14, 2017
Merged
Conversation
Unmounting nested modals should remove the matching number of `modal-open` classes from the body node. Previously, the updated class names were computed before its children are unmounted and only updated in the DOM afterwards. This can cause `modal-open` class name to be left on the body if any of its children is also a modal (which is also trying to remove those `modal-open` classes).
TheSharpieOne
approved these changes
Feb 13, 2017
eddywashere
reviewed
Feb 14, 2017
| jasmine.clock().tick(300); | ||
| expect(wrapper.children().length).toBe(0); | ||
| expect(document.getElementsByClassName('modal-dialog').length).toBe(2); | ||
| expect(document.body.className).toBe('modal-open modal-open'); |
Member
There was a problem hiding this comment.
will need to follow up with a proper fix for duplicate classes by either tracking active modals or using a prop as a flag for managing that body class.
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.
Unmounting nested modals should remove the matching number of
modal-openclasses from the body node. Previously, the updated classnames were computed before its children are unmounted and only updated
in the DOM afterwards. This can cause
modal-openclass name to be lefton the body if any of its children is also a modal (which is also trying
to remove those
modal-openclasses).Here's an demo of the issue: http://www.webpackbin.com/4J7BkUsPf
Example 2Show Nested Model<- typo in the example!All Donewhich unmounts the example 2 componentmodal-openclass left on the body node