Skip to content

Activate a clickable SettingsCard on release instead of on press - #5478

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/5475-settings-touch-scroll
Oct 6, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/5475-settings-touch-scroll

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

SettingsCard invoked the click from its PointerPressed handler, so a touch screen fired it the instant the finger landed: the press synthesizes a left button down before the user has moved far enough for Avalonia's ScrollGestureRecognizer to claim the gesture. The page scrolled and the card under the initial touch navigated away at the same time, which is what made the Settings and Package Manager Preferences pages unusable with touch. The card marking the press handled does not suppress the scroll, because the recognizers run as handledEventsToo class handlers.

Follow the protocol Avalonia's own Button uses. The press only records that the card saw it; the release invokes the click, gated on the initial button being the left one and on the release point still hitting the card; and PointerCaptureLost clears the pending press. That last handler is what cancels the navigation: when the scroll starts, ScrollGestureRecognizer captures the pointer, which routes through Pointer.CaptureGestureRecognizer to Capture(null) and raises PointerCaptureLost on every ancestor of the implicitly captured element, the card included. The touch end is then delivered to the recognizer rather than to the card.

Keyboard activation through Enter and Space is unchanged.

Fixes #5475

SettingsCard invoked the click from its PointerPressed handler, so a touch
screen fired it the instant the finger landed: the press synthesizes a left
button down before the user has moved far enough for Avalonia's
ScrollGestureRecognizer to claim the gesture. The page scrolled and the card
under the initial touch navigated away at the same time, which is what made
the Settings and Package Manager Preferences pages unusable with touch. The
card marking the press handled does not suppress the scroll, because the
recognizers run as handledEventsToo class handlers.

Follow the protocol Avalonia's own Button uses. The press only records that
the card saw it; the release invokes the click, gated on the initial button
being the left one and on the release point still hitting the card; and
PointerCaptureLost clears the pending press. That last handler is what
cancels the navigation: when the scroll starts, ScrollGestureRecognizer
captures the pointer, which routes through Pointer.CaptureGestureRecognizer
to Capture(null) and raises PointerCaptureLost on every ancestor of the
implicitly captured element, the card included. The touch end is then
delivered to the recognizer rather than to the card.

Keyboard activation through Enter and Space is unchanged.

Fixes #5475

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟢 Approval recommended

The implementation follows Avalonia button semantics and addresses the touch-scrolling conflict without changing keyboard activation.

Review effort: Balanced
Findings: None

What changed in this PR

Moves clickable SettingsCard activation from pointer press to release, preventing touch-scroll gestures from triggering navigation.

Changes:

  • Tracks valid left-button presses.
  • Activates only when released over the card.
  • Cancels pending activation when pointer capture is lost.
File Description
src/​UniGetUI.Avalonia/​Views/​Controls/​Settings/​SettingsCard.cs Implements release-based pointer activation and scroll cancellation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "99886650-c19f-11f1-95fd-8f3398189180",
	"headSha": "5abb18cd82347f51d3754126961dca2a9445aa36",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit fb25678 into main Oct 6, 2026
6 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/5475-settings-touch-scroll branch October 6, 2026 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Click gesture overrides scroll gesture in UnigetUI Settings page on a touch screen

2 participants