-
-
Notifications
You must be signed in to change notification settings - Fork 96
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
Screen Glitch When Close Modal #495
Comments
Temporary fix ( mount|unmount ) modal{
open && <Modal />
} import "./styles.css";
import "react-responsive-modal/styles.css";
import { Modal } from "react-responsive-modal";
import { useState } from "react";
export default function App() {
const [open, setOpen] = useState(false);
const onOpenModal = () => setOpen(true);
const onCloseModal = () => setOpen(false);
return (
<div className="App">
<h1>Hello CodeSandbox</h1>
<button onClick={onOpenModal}>Open</button>
{open && (
<Modal open={open} onClose={onCloseModal} center>
<h2>Simple centered modal</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam
pulvinar risus non risus hendrerit venenatis. Pellentesque sit amet
hendrerit risus, sed porttitor quam.
</p>
</Modal>
)}
</div>
);
} |
Thank you for your workaround @omkhetwal. Does this happen often in any case? |
@ardyanrizki I'm not sure, there were more than 4 instances where I had to use Modal in the application, at some place I noticed there wasn't any glitch, then I checked the difference so when I came across your issue, I did the change and worked for me too. |
I have the same issue (with same versions), any updates on this? |
Same issue here |
+1 |
I blame this on React 18. Started happening to me after upgrading to React 18 |
Same for me |
Some investigations here radix-ui/primitives#1344 |
I fixed it in a different way, maybe it is worse, but I don't want to unmount component: const ref = useRef<HTMLDivElement>(null);
return (<Modal
ref={ref}
onClose={_ => setOpen(false)}
onAnimationEnd={() => {
if (!open) {
if (ref.current) {
ref.current.style.opacity = "0%";
}
if (ref.current?.parentElement?.parentElement) {
ref.current.parentElement.parentElement.style.opacity = "0%";
}
}
}}>
{children}
</Modal>); |
When it will be fixed? |
I have the exact same issue, with the versions:
|
add css |
Same issue with the closing animation, adding the CSS that @AVPletnev posted solved it. |
Indeed @AVPletnev's CSS fixed it thanks! |
Fixed with this one line css. Credit and big thanks to @AVPletnev #495 (comment)
|
I think this PR needs to stay in open state because repo and NPM package is still not fixed. |
Fixed with this one line css. Credit and big thanks to @AVPletnev
|
This is still an issue in the latest version of the package. While the suggestion helps work around it, the issue is with the package. |
This fixes the issue but introduces a different one for me, makes my modal have different color values throughout its window: My guess is this has something to do with the animation not fully completing when using animation-fill-mode: forwards. Causing a slight bit of transparency. |
this one works for me as well! .react-responsive-modal-modal { animation-fill-mode: forwards !important; } |
same issue |
Bug report
Describe the bug
When closing the modal an unexpected page glitch/blinking screen occurs. The modal still could close completely after that.
To Reproduce
Take action to close the modal either by clicking modal's close button, ESC, or custom button inside modal that calls the close function.
Expected behavior
Modal closes smoothly without any odd blinks.
Screenshots
Screen.Recording.2022-05-11.at.20.22.05.mov
System information
Additional context
This case happens on my web page here. You can clicking the kebab menu (three dots icon) at the top right page to show the modal and then click "Cancel" to close it.
The text was updated successfully, but these errors were encountered: