Elements remain after closing a modal in React18
See original GitHub issueDescription
When using the Modal component of @chakra-ui/react
in an environment with React18 installed, the DOM element seems to remain after the modal is closed. This makes it impossible to click on other elements.
Link to Reproduction
https://codesandbox.io/s/chakra-ui-react18-reproduction-il8ux
Steps to reproduce
- Click
Open Modal
button - Click
Close
button - The
Open Modal
button cannot be pressed
Chakra UI Version
1.7.4
Browser
Google Chrome 96.0.4664.110(Official Build)(arm64)
Operating System
- macOS
- Windows
- Linux
Additional Information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:7 (1 by maintainers)
Top Results From Across the Web
disabling focus after closing modal in React component
In the React app I'm working on, a cancel button is located at the bottom of a page. When a user clicks on...
Read more >Using React Portals to build a modal - LogRocket Blog
This works well, except that the modal remains in the DOM even after closing. We can also set the display property to none...
Read more >Portals - React
Portals provide a first-class way to render children into a DOM node that exists outside the DOM hierarchy of the parent component. ......
Read more >react-modal - npm
Accessible modal dialog component for React.JS. Latest version: 3.16.1, last published: 2 months ago. Start using react-modal in your ...
Read more >Problem with Chakra UI modal component : r/reactjs - Reddit
The problem with the Chakra modal is that, after closing, the overlay doesn't get deleted, which means it sits on top of all...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve found the issue, when I removed
<StrictMode/>
which was there by default it started working.Hi @otofu-square. Chakra UI doesn’t support React 18 just yet therefore it’s not a bug.
We might need a major release to support it due to possible breaking changes/behavior.
Thanks for understanding.