question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Elements remain after closing a modal in React18

See original GitHub issue

Description

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

  1. Click Open Modal button
  2. Click Close button
  3. 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
jdmitrijevcommented, Aug 10, 2022

I’ve found the issue, when I removed <StrictMode/> which was there by default it started working.

6reactions
segunadebayocommented, Jan 5, 2022

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found