Semantic-UI-React: Multiple modals scrolling bug
dimmable dimmed
are deleted from body
when the second modal is closed
Steps
- Scroll modal
- Open second modal
- Scroll modal
- Close second modal
- Try to scroll modal
Expected Result
The first modal should be scrollable
<body class="dimmable dimmed scrolling">
Actual Result
First Modal is not longer scrollabel
<body class="scrolling">
Version
tested in 0.64.0 & 0.63.5
Testcase
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 16
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Fix modal scrolling bug Fixes #1157, #2248 — committed to RetroCraft/Semantic-UI-React by RetroCraft 7 years ago
my temporary fix
Yep, this makes sense. I think it is time to consider a stack for managing things like overlays and document level keybindings.
Another example of this issue is pressing ESC. This will close all Dropdowns, Popups, Modals, and anything else that has a document level listener for ESC. Ideally, we’d have a stack of listeners and only the most recent would be invoked and removed. That way, only the top level component unmounts. This would allow opening/closing a Popup inside of a Modal without also closing the Modal.
The stack could also be used here to keep the classes on the body until there were no more page dimmers in the stack.
@jcarbo / @layershifter have you run into needs that would be well served by a stack or top-level Provider component for managing state such as listeners and multiple Portals?
If still not working well with @marcdibold fix, try bellow:
This commit solves the issue with closing one of modal in presence of others. Unfortunately I don’t know hot to make a PR out of 1 commit only (not the whole branch)
(fix) When modal window unmounts it reverts portal’s original class list, instead of resetting it https://github.com/rasdaniil/Semantic-UI-React/commit/17c19777f59e4b7b1b0976a7bece01e203de5873
PR up in #2010 to fix this issue.