Repository navigation
Conversation
rozele
force-pushed
the
export-D126767220
branch
from
October 22, 2026 14:04
b3290b4 to
14924d0
Compare
|
@rozele has exported this pull request. If you are a Meta employee, you can view the originating Diff in D126767220. |
…eact#59363) Summary: Pull Request resolved: react#59363 `Pressability._createEventHandlers` destructured `onHoverIn`/`onHoverOut` out of `this._config` once, and `getEventHandlers` memoises the handler object for the life of the instance. `configure` replaces the config on every update, but the W3C-pointer hover closures kept calling the callbacks captured when the handlers were first created, so a hover callback that closes over component state observed that state as it was at mount, for the life of the view, however many times the component re-rendered. Every other handler in `_createEventHandlers` already reads `this._config` inside its own body, and so does the legacy mouse branch below. This makes the W3C pointer branch do the same. It also restores `reset`'s documented guarantee for hover: after `reset` freezes `this._config`, a late `onPointerEnter` no longer calls a configured callback. Whether to attach `onPointerEnter`/`onPointerLeave` at all is still decided once, from the config present when the handlers are created, because that presence is what makes the host view listen for pointer enter/leave. A view that mounts without a hover callback and is given one later still does not begin listening. That behaviour is unchanged by this diff. Only the branch behind `shouldPressibilityUseW3CPointerEventsForHover` is touched. With that flag at its default the generated handlers are byte-identical to before. Changelog: [General][Fixed] - `Pressability` now invokes the current `onHoverIn`/`onHoverOut` rather than the ones captured when its event handlers were created Differential Revision: D126767220
rozele
force-pushed
the
export-D126767220
branch
from
October 22, 2026 14:09
14924d0 to
b78ca52
Compare
Collaborator
|
This pull request was successfully merged by @rozele in 8a4cf38 When will my fix make it into a release? | How to file a pick request? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Pressability._createEventHandlersdestructuredonHoverIn/onHoverOutout ofthis._configonce, andgetEventHandlersmemoises the handler object for thelife of the instance.
configurereplaces the config on every update, but theW3C-pointer hover closures kept calling the callbacks captured when the handlers
were first created, so a hover callback that closes over component state observed
that state as it was at mount, for the life of the view, however many times the
component re-rendered.
Every other handler in
_createEventHandlersalready readsthis._configinsideits own body, and so does the legacy mouse branch below. This makes the W3C
pointer branch do the same. It also restores
reset's documented guarantee forhover: after
resetfreezesthis._config, a lateonPointerEnterno longercalls a configured callback.
Whether to attach
onPointerEnter/onPointerLeaveat all is still decided once,from the config present when the handlers are created, because that presence is
what makes the host view listen for pointer enter/leave. A view that mounts
without a hover callback and is given one later still does not begin listening.
That behaviour is unchanged by this diff.
Only the branch behind
shouldPressibilityUseW3CPointerEventsForHoveristouched. With that flag at its default the generated handlers are byte-identical
to before.
Changelog:
[General][Fixed] -
Pressabilitynow invokes the currentonHoverIn/onHoverOutrather than the ones captured when its event handlers were createdDifferential Revision: D126767220