[Windows] Border: Keyboard tap support for TapGestureRecognizer#35578
[Windows] Border: Keyboard tap support for TapGestureRecognizer#35578Vignesh-SF3580 wants to merge 3 commits into
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35578Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35578" |
|
/review -b feature/regression-check |
🔍 Multimodal Code Review — PR #35578[Windows] Border: Keyboard tap support for TapGestureRecognizer Overall this is a well-structured PR that adds keyboard accessibility to 🐛 Bug: Missing
|
|
/review |
|
/review -b feature/refactor-copilot-yml |
@kubaflo I have addressed the suggestions.
|
|
/review -b feature/refactor-copilot-yml -p windows |
|
|
|
/azp run maui-pr-uitests, maui-pr-devicetests |
|
Azure Pipelines successfully started running 2 pipeline(s). |
AI code review refresh for net11.0 targetHead reviewed: 6040501 Verdict: Blocked/limited — I did not find a new code issue in the Windows Border keyboard-tap changes, but the latest explicitly-triggered CI is not green, so I cannot restate LGTM/merge-ready. Findings
CI note
Confidence: medium-high on the code review; medium on CI non-correlation because Build Analysis did not match these latest failures to known issues. Not an approval; this is an automated review refresh comment only. |
kubaflo
left a comment
There was a problem hiding this comment.
Verdict: NEEDS_CHANGES (confidence: medium)
Validating against the actual code resolves the split: opus-4.8's bubbled-KeyDown concern is confirmed real — ContentPanelOnKeyDown is attached to the ContentPanel (an ancestor of the Border's content) yet never checks e.OriginalSource/focus, so a focusable child whose Enter/Space isn't consumed (e.g. a single-line Entry on Enter) bubbles up and spuriously fires the Border's tap (then e.Handled = true swallows the key). gpt-5.5's auto-repeat concern is also real and corroborated in-repo: the Windows path fires on auto-repeating KeyDown, whereas the Android OnKeyPress it claims parity with deliberately acts only on KeyEventActions.Up. These are concrete code fixes, not just discussion, so the verdict lands past NEEDS_DISCUSSION/LGTM.
Why the models split: opus-4.6 (LGTM) verified the prior-round fixes landed and pattern-matched the subscription lifecycle, but dismissed the failing Windows device-test leg as infra/"no results" and didn't analyze WinUI routed-event bubbling, so it missed the missing origin guard. gemini (NEEDS_CHANGES, 0 inline) gated correctly on CI but produced no code finding. gpt-5.5 and opus-4.8 each found one of the two real handler gaps but framed them as discussion. Cross-pollination keeps both code findings plus the test-coverage gap.
Key findings (all novel — prior rounds only raised the now-fixed IsEnabled guard):
- [warning] Missing origin/focus guard in
ContentPanelOnKeyDown(GesturePlatformManager.Windows.cs:440): bubbled Enter/Space from a focusable child can spuriously activate the Border'sTapGestureRecognizer. Fix:if (!ReferenceEquals(e.OriginalSource, sender)) return;or checkFocusState. - [warning] Fires on auto-repeating
KeyDown(GesturePlatformManager.Windows.cs:457): holding the key re-runsSendTapped. Android parity path fires once onKeyUp. Fix: guarde.KeyStatus.WasKeyDownor activate onKeyUp. - [suggestion] Test gap (BorderTests.Windows.cs:107): only asserts
IsTabStop, never exercises actual Enter/Space dispatch — the core behavior is unprotected by regression tests.
Already addressed in this head (do NOT re-raise): IsEnabled guard, secondary-tap (RightTapped) subscription regression, Control setter detaching KeyDown, and the byte → ushort widening for 1 << 8.
CI: Not green. The directly relevant maui-pr-devicetests (net11.0 Windows Helix Tests Run DeviceTests Windows) leg FAILED (the Windows Build leg passed). Overall 17 checks failing (also Windows-unrelated: MacCatalyst/iOS/Android device + UI test legs). Independently of the code findings, the failing net11.0 Windows Run DeviceTests leg makes this not LGTM-eligible; the new BorderTests.Windows should be confirmed running green before merge.
@kubaflo I have addressed the valid changes.
|
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Description of Change
This PR is the second half of the split from #27713. It adds keyboard interaction support for
Borderon Windows, allowing users to activate aBorderwith aTapGestureRecognizerusing the keyboard.A
Borderwith a single-tap, primary-buttonTapGestureRecognizeris now keyboard actionable on Windows:ContentPanel.IsTabStopis set totrue, allowing theBorderto participate in tab navigation.Borderhas focus invokes the attachedTapGestureRecognizerthroughSendTapped, usingPoint.Zeroas the tap position, matching Android’s keyboard-tap behavior.The tab-stop state stays synchronized with the gesture collection:
TapGestureRecognizerenables tab-stop behavior and subscribes toKeyDown.KeyDown.Only gestures attached directly to the
Bordermake it keyboard actionable. Gestures attached to child elements do not promote the parentBorderinto a tab stop, since child elements manage their own keyboard focus independently.Internal bookkeeping updates:
SubscriptionFlagswas widened frombytetoushort.ContentPanelKeyDownSubscribedflag to track theKeyDownsubscription lifecycle and prevent duplicate event subscriptions or removals.How it works
On Windows, a MAUI Border is rendered by a native ContentPanel that, by default, does not participate in keyboard navigation or connect KeyDown events to MAUI gestures. Because of this, a Border with a TapGestureRecognizer was clickable but not keyboard accessible. This PR adds that missing behavior in GesturePlatformManager.Windows.
Note:
AutomationPeer support for Border was submitted separately in #35577 against main. Once that change flows into net11.0, the keyboard-actionable Border introduced here will also be properly exposed to UI Automation, completing the end-to-end accessibility support for Border on Windows.
Issues Fixed
Fixes #27627