You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The close method does not work correctly when two overlays are overlapped.
Example:
Except Styling Code
In this situation, to open the first overlay and close it, you rely on the return value of the second overlay.
(Frequent Case: Check 'Do you want to close?')
At this point, the second overlay is closed and the close function of the first overlay is executed correctly,
but again the isOpen value of the first overlay is true (see video)
import'./App.css'import{overlay}from'overlay-kit'functionApp(){return(<><buttononClick={()=>{overlay.open(({ isOpen, close })=>{console.log('isOpen',isOpen);returnisOpen ? (<FirstOverlayopen={isOpen}onSubmit={()=>{close()}}/>) : null})}}>
Open First Overlay
</button></>)}functionFirstOverlay({ open, onSubmit }: {open: boolean,onSubmit: ()=>void}){if(!open)returnnull;consthandleButtonClick=async()=>{constisConfirmed=awaitSecondOverlay();if(isConfirmed){onSubmit();}}return(<divclassName="overlay"><divclassName="overlay-content first-overlay"><h2>First Overlay</h2><buttononClick={handleButtonClick}>Open Second Overlay</button></div></div>)}asyncfunctionSecondOverlay(){returnnewPromise<boolean>(resolve=>{overlay.open(({ isOpen, close })=>{returnisOpen ? (<divclassName="overlay"><divclassName="overlay-content inner-overlay"><h2>Second Overlay</h2><buttononClick={()=>{close();resolve(true)}}>Submit</button></div></div>) : null})})}exportdefaultApp
2025-02-05.10.55.10.mov
The text was updated successfully, but these errors were encountered:
Looking at the example code you provided, when the submit button in SecondOverlay is clicked, the onSubmit prop of FirstOverlay is executed, so the first overlay should also close.
2025-02-12.2.45.23.mov
Based on my testing, I was able to confirm that it actually closes. Could you let me know which version of overlay-kit you are using?
It would be even better if you could share a CodeSandbox link or a GitHub repository where the issue can be reproduced.
Issue Description:
The close method does not work correctly when two overlays are overlapped.
Example:
Except Styling Code
In this situation, to open the first overlay and close it, you rely on the return value of the second overlay.
(Frequent Case:
Check 'Do you want to close?'
)At this point, the second overlay is closed and the close function of the first overlay is executed correctly,
but again the
isOpen
value of the first overlay istrue
(see video)2025-02-05.10.55.10.mov
The text was updated successfully, but these errors were encountered: