Skip to content

[Toast] Fix timer issues #1682

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

Merged
merged 3 commits into from
Sep 26, 2022
Merged

[Toast] Fix timer issues #1682

merged 3 commits into from
Sep 26, 2022

Conversation

andy-hook
Copy link
Contributor

@andy-hook andy-hook commented Sep 22, 2022

Address timer issues mentioned in #1669 (comment)

The underlying issue is that the pause handling doesn't account for multiple calls in succession. Because we're now exposing onPause and onResume it made more sense to address the issue at source with the duplicate events being fired.

@benoitgrelard might be easier to hop on a call to go over this.

@andy-hook andy-hook marked this pull request as ready for review September 23, 2022 11:39

const handleFocusOutResume = (event: FocusEvent) => {
// Only resume when focus moves out of the wrapper
if (!wrapper.contains(event.relatedTarget as HTMLElement)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still need to handle for this as focusout / focusin will fire while tabbing within wrapper and we don't want to flip the flag until we're back outside.

@benoitgrelard
Copy link
Contributor

I think I spotted another issue:

CleanShot.2022-09-26.at.13.49.05.mp4

Leave should only trigger resume if focus isn't inside right?

@andy-hook
Copy link
Contributor Author

Leave should only trigger resume if focus isn't inside right?

Good spot, tweaked a little. Let me know how that feels.

@benoitgrelard benoitgrelard merged commit b82c0a7 into main Sep 26, 2022
@benoitgrelard benoitgrelard deleted the toast-fix-timers branch September 26, 2022 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants