react-modal icon indicating copy to clipboard operation
react-modal copied to clipboard

[BUG] ReactModal__Body--open not removed when using css animation, and "fast click" on modal trigger button

Open firzx77 opened this issue 6 years ago • 3 comments

Summary:

When css animation added and open modal with toggle button, and then I'm doing like "fast click" on the trigger button, ReactModal__Body--open will not removed from the body

gif

Expected behavior:

The ReactModal__Body--open class would removed from the body though "fast click" the trigger button

Link to example of issue:

https://codepen.io/firzx77/pen/PrZOEY

firzx77 avatar Jun 15 '19 05:06 firzx77

Any update on this issue ?, In my case when I'm immediately opening another modal after closing the other one, ReactModal__Body--open does not get removed from body.classList

anshulsahni avatar Aug 19 '19 12:08 anshulsahni

@firzx77 @anshulsahni This seems to be the case where the modal didn't have enough time to go ahead and remove the classes. Internally, it cancels the scheduled clean up function and act as if was kept open and finish the animation from where it was left.

See https://github.com/reactjs/react-modal/blob/master/src/components/ModalPortal.js#L198 https://github.com/reactjs/react-modal/blob/master/src/components/ModalPortal.js#L199.

Hope this can clarify.

diasbruno avatar Aug 28 '19 15:08 diasbruno

Same here.

goldmont avatar Jun 04 '21 14:06 goldmont