Skip to content

Conversation

Saadnajmi
Copy link
Collaborator

@Saadnajmi Saadnajmi commented Sep 29, 2025

Summary:

Cherry pick and rebase a bunch of changes to implement onMouseEnter and onMouseLeave for View in Fabric

Test Plan:

The existing test in "Pressable Feedback Events" works in Fabric.

@Saadnajmi Saadnajmi requested a review from a team as a code owner September 29, 2025 23:07
@Saadnajmi Saadnajmi marked this pull request as draft September 29, 2025 23:08
Nick Lefever added 5 commits September 30, 2025 09:37
Summary:
This diff adds the `onMouseEnter` and `onMouseLeave` event handler props and event emitters to the View component in Fabric.

The mouse event data is the same that was provided by the Paper implementation in `RCTView`.

These changes were made in the macOS specific extension of the View component props.

Test Plan: Tested later in this stack.

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D53529016

Tasks: T154617556
Summary:
This diff implements mouse enter/leave tracking for the area covered by the View component.

The tracking is handled by configuring a tracking area on the NSView when either of the handlers is set on the view. This enables the NSResponder `mouseEntered:` and `mouseExited:` notifications which are translated to mouse events.

Test Plan:
* Run Zeratul with Fabric enabled.
* Move the cursor over controls that have hover-dependent styling.

 https://pxl.cl/4jSw5

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D53529015

Tasks: T154617556
Summary:
Views having mouse event handlers assigned to them should not be flattened so that the mouse tracking for the area they cover would work at all times.

This diff disabled view flattening if either of the mouse event handlers is set.

Test Plan: Tested later in this stack.

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D53529017

Tasks: T154617556
…ents

Summary: This diff adds null checks to avoid sending key and/or mouse events before the event emitter was assigned to the component.

Test Plan:
* Run Zeratul with Fabric enabled
* Hover over buttons
* Use up/down arrows in composer on user tag selector

 https://pxl.cl/4jVCb

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D53555261
Summary:
This diff adds a bounds change observer to the wrapping clip view, allowing to be notified when the view position is changing because a parent scroll view is being scrolled.

This allows the view to evaluate the new cursor position and check if mouse enter/leave events have to be emitted.

Test Plan:
* Run Zeratul with Fabric enabled.
* Scroll the messages view without moving the cursor position and check that enter/leave tracking is working as expected.

 https://pxl.cl/4jSxh

Reviewers: shawndempsey, #rn-desktop

Reviewed By: shawndempsey

Differential Revision: https://phabricator.intern.facebook.com/D53529018

Tasks: T154617556
@Saadnajmi Saadnajmi marked this pull request as ready for review September 30, 2025 22:38
Saadnajmi and others added 2 commits October 1, 2025 06:34
Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
@Saadnajmi Saadnajmi merged commit 2dddc18 into microsoft:main Oct 1, 2025
21 checks passed
@Saadnajmi Saadnajmi deleted the mouse branch October 1, 2025 19:28
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