Skip to content

Require the same button for both clicks of a double tap - #22429

Merged
MrJul merged 7 commits into
AvaloniaUI:mainfrom
Evan260:fix-doubletap-requires-same-button
Oct 22, 2026
Merged

MrJul merged 7 commits into
AvaloniaUI:mainfrom
Evan260:fix-doubletap-requires-same-button

Conversation

@Evan260

@Evan260 Evan260 commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

What does the pull request do?

Requires both clicks of a double tap to come from the same button.

What is the current behavior?

A right click followed quickly by a left click raises DoubleTapped. The platform raises the second press with ClickCount 2 whichever button was used, and the check only tests that the current press is the left button, not the one that started the sequence.

What is the updated/expected behavior with this PR?

The button that started the sequence is recorded, and DoubleTapped is only raised when the second press uses the same one. A right click followed by a left click now raises RightTapped and then Tapped.

Fixed issues

Fixes #18911

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

NuGet packages

The packages for this pull request have been published (workflow run):

@Evan260
Evan260 force-pushed the fix-doubletap-requires-same-button branch from d519145 to 900196d Compare October 11, 2026 01:26
@MrJul MrJul added bug backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Oct 15, 2026

@MrJul MrJul left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the wrong layer to do the fix. We should reset ClickCount in MouseDevice and PenDevice whenever the pressed button changes, so all consumers are naturally fixed.

@Evan260
Evan260 force-pushed the fix-doubletap-requires-same-button branch from f49ac9e to bdb4d1c Compare October 21, 2026 18:16
@Evan260

Evan260 commented Oct 21, 2026

Copy link
Copy Markdown
Contributor Author

Sounds good, made the changes.

@MrJul
MrJul enabled auto-merge October 22, 2026 07:58
@MrJul
MrJul added this pull request to the merge queue Oct 22, 2026
Merged via the queue into AvaloniaUI:main with commit e4452b5 Oct 22, 2026
15 of 16 checks passed
@Evan260
Evan260 deleted the fix-doubletap-requires-same-button branch October 22, 2026 20:51
MrJul added a commit that referenced this pull request Nov 2, 2026
* Add double tapped test

* Check both clicks are left for double tap

* Add a test for the click count restarting on a different button

* Restart the click count when the pressed button changes

---------

Co-authored-by: Julien Lebosquain <julien@lebosquain.net>
Co-authored-by: Emmanuel Hansen <emmausssss@gmail.com>
@MrJul MrJul added backported-12.1.x and removed backport-candidate-12.1.x Consider this PR for backporting to 12.1 branch labels Nov 2, 2026
Zaneris added a commit to Zaneris/passenger that referenced this pull request Nov 4, 2026
…_quick_run_and_right_after_a_click passes again. Ui.SideClick expected Back's button pressed right after a left click at the same place to come as the second click of one run, as Avalonia counted every quick press there whatever its button until 12.1.5 (#1172's move from 12.1.4), which starts a new run when the button changes (AvaloniaUI/Avalonia#22429, "Require the same button for both clicks of a double tap"), so the presses were counted 1, 1 and the test failed on every system in the 0.3.0 PR's CI run (41847036147) and on the Mac. SideClick now expects the left click's run and the side button's own (1, then 1 to N), naming both in its failure, and Keymap.ActionForAnyClick's comment says the platform counts a run of one button's presses; the product is unchanged, a quick run of Back's presses still stepping back at each one and a Back after a click stepping back. On the Mac at 13adb12 the test failed ("counted as clicks 1, 1"), and with this change it passes (#1265).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGn3U8Whdfjw7qqRtgmQLz
Zaneris added a commit to Zaneris/passenger that referenced this pull request Nov 4, 2026
…f another button starting a new run (AvaloniaUI/Avalonia#22429, behind NavigationTests' fix in 173e9ff); 0.3.0's release notes say the status bar's words read whole at the smallest window again (#1265).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGn3U8Whdfjw7qqRtgmQLz
Zaneris added a commit to Zaneris/passenger that referenced this pull request Nov 4, 2026
…thread_in_the_rows_it_shows now compares two lists alike but for their length, and a key no longer throws an exception on the window's thread as it puts off a debounced wait. The test compared a statement's list of 97 items, complete and showing one row, with one of the server's thousand, incomplete and so asked for again at every key, showing eleven rows, whose labels hung on whether the server had indexed the types of namespaces not imported (in one run the short list held 55 labels); the 32 KB it allowed covered those differences until 4b33001 (#1217's carried Inter) cut about 15 KB from the short list's key and nothing from the long one's (bisected on the Mac: 66.9 and 82.1 KB before it, 51.5 and 82.8 KB at it), and the test failed on every system in the 0.3.0 PR's CI run (41847036147). It now narrows a class's members after its dot, Pantry's 220 fields or Granary's 980 (the shared project's Pantry.cs and Granary.cs, each field named Ration000 on), which the server lists whole and the same at each key, so both lists hold 200 rows narrowed by "Ra", "Rat" and "Rati" and show the same ones, Ration000 first; and a key into the longer list must cost the UI thread less than the least object (24 bytes) for each item it has more, where it allowed 32 KB. On the Mac the two keys cost 57.6 and 56 KB (223 and 983 items), and the test passes twice. Debounce's wait, the C# semantic colours' wait before asking the server and their idle wait, and the server diagnostics' pull's pause now end without an exception when typing goes on (Task.Delay awaited with SuppressThrowing, still on the window's thread), where each key threw a TaskCanceledException on the window's thread from Debounce.WaitAsync and SemanticHighlighter.Fetch, and the first key after a pause one from DiagnosticMarks' PullAsync; a key into an incomplete list still throws one where its earlier request is cancelled (CodeCompletion.ServerListAsync) (#1265).

For CLAUDE.md's traps: Avalonia 12.1.5 counts a run of clicks for one button: a press of another button starts a new run, so a side button pressed right after a left click is click 1, never 2 (AvaloniaUI/Avalonia#22429).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GGn3U8Whdfjw7qqRtgmQLz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DoubleTappedEvent raised after clicking right then left buttons

3 participants