-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
fix(overlays): prevent overlays from getting stuck open #28069
Conversation
Run & review this pull request in StackBlitz Codeflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a couple bugs, but otherwise this looks good!
Co-authored-by: Liam DeBeasi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry one last thing - found a typo :)
Co-authored-by: Liam DeBeasi <[email protected]>
I am still seeing this with:
Please let me know how I can help. |
Here's a video of a test I created using a fresh react project made with This may seem like an edge case and it could be argued that ion-overlay-dismiss-bug.mov |
@adamduren Thank you for bringing this to our attention! Please open a new issue so the team can track it separately. |
here is a workaround for this import { IonLoading } from "@ionic/react";
import { useEffect, useRef } from "react";
const LoadingIndicator = ({
isOpen,
...props
}: React.ComponentProps<typeof IonLoading>) => {
const ref = useRef<HTMLIonLoadingElement>(null);
useEffect(() => {
ref.current?.[isOpen ? "present" : "dismiss"]();
}, [isOpen]);
if (!isOpen) return null;
return <IonLoading ref={ref} {...props} />;
};
export default LoadingIndicator; <LoadingIndicator isOpen={isLoading} /> |
Does not show the popup dialog. When I remove |
Issue number: resolves #27200
What is the current behavior?
A bug occurs when you click twice quickly to open an overlay with a small timeout. In some cases, the overlay will present, dismiss, present, then not dismiss the second time, getting stuck open. You can reproduce manually this by grabbing the test HTML included in this PR and putting it in a branch that doesn't include a fix.
What is the new behavior?
Does this introduce a breaking change?
Other information
Relevant links:
I'm not sure how to write an automated test for this bug due to the short timeout required.
You can manually test the fix in this Stackblitz by changing the Ionic version between 7.3.1 and 7.3.2-dev.11693262117.17edbf6d