-
Notifications
You must be signed in to change notification settings - Fork 473
[Android] TouchBehavior prevents keyboard Tab navigation to next element - fix #2673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the Android touch behavior to preserve native keyboard focus navigation by explicitly not marking key events as handled.
- Added
e.Handled = false;inOnKeyPressedto prevent hijacking keyboard input. - Ensures other controls and system logic continue receiving key events on Android.
Comments suppressed due to low confidence (1)
src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs:130
- Add a unit or integration test to verify that
OnKeyPressedleavese.Handledas false and that keyboard navigation remains functional after this change.
e.Handled = false;
src/CommunityToolkit.Maui/Behaviors/PlatformBehaviors/Touch/TouchBehavior.android.cs
Show resolved
Hide resolved
pictos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
TheCodeTraveler
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kubaflo!! Approved ✅
I will resolve the errors in our build pipeline shortly then merge this PR 👍
|
Thanks, @pictos and @TheCodeTraveler, for your prompt response! I need this fix for my app, so I greatly appreciate it! |
|
No problem! This'll be in Friday's release. |
Description of Change
e.Handled = false;is essential here because it preserves native focus navigation. Without it, your behavior unintentionally blocks keyboard input from reaching other controls or triggering system logic.This subtle line prevents your TouchBehavior from hijacking the keyboard navigation experience — especially important on Android where keyboard interactions are more commonly used with physical keyboards or accessibility tools.
Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PRScreen.Recording.2025-05-26.at.20.00.21.mov
Screen.Recording.2025-05-26.at.19.58.19.mov