Repository navigation
fix: Fix Toast hover and focus behavior - #7838
Conversation
snowystinger
left a comment
There was a problem hiding this comment.
Honestly, looks good.
I found one odd behaviour, it's pretty funny actually, i'm not sure if it's our use of the view transition, but if you go to https://reactspectrum.blob.core.windows.net/reactspectrum/7c52fbb93e978a61c345aed6055f044805e1313b/docs/react-spectrum/Toast.html#auto-dismiss
and you open a bunch of toasts and wait for them to disappear without moving your mouse off the trigger button, then the trigger button will flash to the default state for each animation
|
I assume that's view transitions since they happen in a layer on top of the page. Does it happen on main? |
|
yeah, happens on main, but doesn't happen in the last release not a big deal, I'm doing something unusual |
|
yeah view transitions are not interruptible unfortunately, so you have to wait for the animation to finish before you can click again |
|
looks like both of those are working, though #4951 seems to be working before. maybe a browser change fixed it? |
9214886
snowystinger
left a comment
There was a problem hiding this comment.
ran chromatic, looks good with the auto opening components, no unexpected changes there
LFDanLu
left a comment
There was a problem hiding this comment.
LGTM, verified hover/focus pause the toast auto dismiss and that the timer resumes when blurring/hovering away. Also verified the difference in behavior between mouse and keyboard when dismissing the Toast and the datepicker/rangepicker blur exception as discussed
|
I'm wondering if the changes to hover behavior will also help with #7004? From looking at the code I think it could be able to fix the issue as well. |
Closes #7834, fixes #1038
useHoverso that it firesonHoverEndwhen an element is removed. The browsers do not firepointerleavein this case, but they do firepointeroveron the new target so we can use this to triggeronHoverEnd. This fixes the case where state gets out of sync, causing the timers not to pause when hovering over the region again after removing a toast.useFocusWithinto fireonBlurWithinwhen focus moves outside, even when noonBluris fired. Browsers do not fireblurwhen an element is removed. However, when focus moves to another element we'll receive afocusevent and we can fireonBlurWithinourselves.