Skip to content

Commit 74b1a4d

Browse files
w3dimeta-codesync[bot]
authored andcommitted
- Fix hover out timeout stored in wrong variable in Pressability (#56328)
Summary: The `onMouseLeave` handler in `Pressability` stores the delayed `onHoverOut` timeout in `_hoverInDelayTimeout` instead of `_hoverOutDelayTimeout`. This is a copy-paste error from the `onMouseEnter` handler above it. The Pointer Events path (`onPointerLeave`, line 593) correctly uses `_hoverOutDelayTimeout`. The Mouse Events path (`onMouseLeave`, line 645) incorrectly uses `_hoverInDelayTimeout`. This causes: - `_cancelHoverOutDelayTimeout()` to not cancel the pending `onHoverOut` callback - `_cancelHoverInDelayTimeout()` to incorrectly cancel `onHoverOut` instead of `onHoverIn` - A pending `onHoverIn` timeout to be silently overwritten if it exists Affects non-mobile platforms (web, desktop) when `delayHoverOut > 0`. ## Changelog: [General] [Fixed] - Fix hover out timeout stored in wrong variable in Pressability Pull Request resolved: #56328 Test Plan: - All 37 existing Pressability tests pass: `yarn jest packages/react-native/Libraries/Pressability/__tests__/Pressability-test.js` - Prettier and ESLint checks pass. - Verified by code inspection: the Pointer Events path (line 593) correctly uses `_hoverOutDelayTimeout`, the Mouse Events path (line 645) now matches. Reviewed By: christophpurrer Differential Revision: D104657310 Pulled By: javache fbshipit-source-id: 66b0b353168102a5e8664e0c9b558cb6a1d7503c
1 parent ddccf61 commit 74b1a4d

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/react-native/Libraries/Pressability/Pressability.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ export default class Pressability {
642642
);
643643
if (delayHoverOut > 0) {
644644
event.persist();
645-
this._hoverInDelayTimeout = setTimeout(() => {
645+
this._hoverOutDelayTimeout = setTimeout(() => {
646646
onHoverOut(event);
647647
}, delayHoverOut);
648648
} else {

0 commit comments

Comments
 (0)