Skip to content

Add button property mouse events#15819

Open
HariniMalothu17 wants to merge 17 commits intomicrosoft:mainfrom
HariniMalothu17:fix/add-button-property-mouse-events
Open

Add button property mouse events#15819
HariniMalothu17 wants to merge 17 commits intomicrosoft:mainfrom
HariniMalothu17:fix/add-button-property-mouse-events

Conversation

@HariniMalothu17
Copy link
Contributor

@HariniMalothu17 HariniMalothu17 commented Mar 20, 2026

Description

Adds support for detecting which mouse button triggered pointer events (left, right, middle, etc.)
and registers missing W3C pointer event handlers in the native event system.

Type of Change

Erase all that don't apply.

  • Bug fix (non-breaking change which fixes an issue)

Why

PointerEvent.button and PointerEvent.buttons were always 0 in JS pointer events (onPointerDown, onPointerUp), making it impossible to distinguish right-clicks from left-clicks. Additionally, several W3C pointer event handlers (onPointerDown, onPointerUp, onClick, etc.) were never registered in the native event bitset because BaseViewProps::setProp() was missing their VIEW_EVENT_CASE entries.

Resolves #15827 #6410

Screenshots

image

Testing

Tested in playground

Optional: Describe the tests that you ran locally to verify your changes.

Changelog

Should this change be included in the release notes: yes

Add a brief summary of the change to use in the release notes for the next release.

Microsoft Reviewers: Open in CodeFlow

@HariniMalothu17 HariniMalothu17 requested a review from a team as a code owner March 20, 2026 11:01
@HariniMalothu17 HariniMalothu17 changed the title Fix/add button property mouse events Add button property mouse events Mar 20, 2026
@HariniMalothu17 HariniMalothu17 marked this pull request as draft March 20, 2026 11:06
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) and removed Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) labels Mar 20, 2026
@HariniMalothu17 HariniMalothu17 marked this pull request as ready for review March 23, 2026 08:18
@HariniMalothu17
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link
Contributor

Azure Pipelines successfully started running 2 pipeline(s).

@HariniMalothu17 HariniMalothu17 force-pushed the fix/add-button-property-mouse-events branch from b9b9b90 to f51e3bb Compare March 23, 2026 09:14
@HariniMalothu17 HariniMalothu17 force-pushed the fix/add-button-property-mouse-events branch from 07cfda6 to 267060a Compare March 23, 2026 09:23
@@ -10,6 +10,7 @@ import {AppRegistry, Text, TouchableHighlight, View} from 'react-native';
export default class Bootstrap extends React.Component {
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than just adding a playground sample, can you add an actual test page to RNTester, and a E2E test that verifies the behavior so we can verify it doesn't break in the future.

@acoates-ms
Copy link
Contributor

Are you sure you need the BaseViewProps.cpp fork? It doesn't look like you are using those new properties?

@HariniMalothu17
Copy link
Contributor Author

HariniMalothu17 commented Mar 24, 2026

Are you sure you need the BaseViewProps.cpp fork? It doesn't look like you are using those new properties?

Yes, the BaseViewProps.cpp fork is needed. The upstream BaseViewProps.cpp was missing VIEW_EVENT_CASE entries for several W3C pointer event handlers (onPointerDown, onPointerUp, onClick, etc.) in setProp(). Without these entries, the native event bitset never registers these handlers, so pointer events don't fire. I've also contributed this fix upstream to React Native so the fork can be removed once the upstream update is pulled in.
facebook/react-native#56188

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.

Add missing W3C pointer event cases and wire up button/buttons on PointerEvent

3 participants