Skip to content

fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded id#16099

Open
gmacmaster wants to merge 2 commits intomicrosoft:mainfrom
Virtual-Fulfillment-Technologies-Inc:vendora/primary-touch-fix
Open

fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded id#16099
gmacmaster wants to merge 2 commits intomicrosoft:mainfrom
Virtual-Fulfillment-Technologies-Inc:vendora/primary-touch-fix

Conversation

@gmacmaster
Copy link
Copy Markdown
Contributor

@gmacmaster gmacmaster commented May 8, 2026

Description

activeTouch.isPrimary was set via pointerId == 1, which only works for
mouse (MOUSE_POINTER_ID == 1). Windows touch pointer IDs are OS-allocated
and essentially never 1, so isPrimary was always false for touch input.
This meant touch pointers never triggered onClick (gated behind
isPrimary && button == 0) and reported incorrect isPrimary in
PointerEvents sent to JS.

Type of Change

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

Why

Replace with pointerPoint.Properties().IsPrimary(), which reads the OS
POINTER_FLAG_PRIMARY flag directly. This API is already used elsewhere
in the codebase (SwitchComponentView, WindowsTextInputComponentView,
Composition.Input).

Resolves: N/a

What

Today, touch fingers never trigger onClick (because isPrimary is always false). After the fix, the primary finger would. Combined with secondary fix 1 above, those new clicks would be dispatched correctly per W3C — but they are still new dispatches that did not happen before. That is a behaviour change worth its own changeset, its own review, and its own test pass.

Changelog

Should this change be included in the release notes: yes

fix: use IsPrimary() for touch pointer isPrimary instead of hardcoded pointer ID check

Microsoft Reviewers: Open in CodeFlow

gmacmaster and others added 2 commits May 7, 2026 21:48
… ID check (#4)

activeTouch.isPrimary was set via `pointerId == 1`, which only works for
  mouse (MOUSE_POINTER_ID == 1). Windows touch pointer IDs are OS-allocated
  and essentially never 1, so isPrimary was always false for touch input.
  This meant touch pointers never triggered onClick (gated behind
  isPrimary && button == 0) and reported incorrect isPrimary in
  PointerEvents sent to JS.

  Replace with pointerPoint.Properties().IsPrimary(), which reads the OS
  POINTER_FLAG_PRIMARY flag directly. This API is already used elsewhere
  in the codebase (SwitchComponentView, WindowsTextInputComponentView,
  Composition.Input).

  (The diagnostics are pre-existing clang noise from missing PCH/Windows headers — not
  related to this change.)
@gmacmaster gmacmaster requested a review from a team as a code owner May 8, 2026 01:59
@acoates-ms
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown
Contributor

Azure Pipelines successfully started running 1 pipeline(s).

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