Repository navigation
[main] [Android] Fix Keyboard="Numeric" Entry no longer accepts OS-locale decimal separator - #38485
Conversation
…cimal separator (#38277) <!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details: - On Android, an Entry using Keyboard.Numeric no longer accepts the locale-specific decimal separator. For example, under Polish culture, pressing , after 1 is ignored instead of producing 1, . ### Root Cause of the issue: - MAUI installs LocalizedDigitsKeyListener to accept the current culture's decimal separator. However, the password handling introduced by #36280 subsequently executes: editText.InputType &= ~InputTypes.NumberVariationPassword; - Even when NumberVariationPassword is already absent, the compound assignment still invokes the InputType setter, which maps to Android's TextView.setInputType() . - Android's setInputType() recreates the KeyListener to match the supplied input type. For ClassNumber , it installs Android's DigitsKeyListener , replacing MAUI's LocalizedDigitsKeyListener . - The replacement listener does not accept the Polish decimal separator in this configuration. Therefore, when the IME commits , , the numeric input filter removes it and the text remains 1 . - The password flag itself does not reject the comma. The regression is caused by the additional InputType assignment replacing the localized listener. ### Description of Change **Localization and Numeric Keyboard Support:** * Added a test (`NumericKeyboardAcceptsPolishDecimalSeparator`) to verify that the numeric keyboard accepts the Polish decimal separator (comma) when the culture is set to Polish (`pl-PL`). The test checks that the correct input type flags are set and that the text input works as expected. **Input Type Handling Improvements:** * Updated `SetInputType` in `EditTextExtensions.cs` to only clear the password variation flags (`TextVariationPassword`, `NumberVariationPassword`) if both the class and variation flags are present, making the logic more robust and preventing unintended flag removal. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #38213 ### Tested the behavior in the following platforms - [ ] Windows - [x] Android - [ ] iOS - [ ] Mac ### Output | Before | After | |----------|----------| | <video src="https://github.com/user-attachments/assets/6f5221df-e597-439c-b44b-b2acaa95e4ee"> | <video src="https://github.com/user-attachments/assets/e950f42d-87e3-4908-b7b1-24b5249acf68"> | <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 169298fa-95aa-47a4-ad1c-512dc3f97871
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
AI Review Summary
@github-actions[bot] — new AI review results are available based on commit
d931be9.
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix
Gate Result: ✅ PASSED
Platform: ANDROID · Base: main · Merge base: 3823473d
| Test | Without Fix (expect FAIL) | With Fix (expect PASS) |
|---|---|---|
📱 EntryHandlerTests (NumericKeyboardAcceptsPolishDecimalSeparator) Category=Entry |
✅ FAIL — 381s | ✅ PASS — 378s |
🔴 Without fix — 📱 EntryHandlerTests (NumericKeyboardAcceptsPolishDecimalSeparator): FAIL ✅ · 381s
(no coded error found; showing last 1200 chars)
"totalMemoryBytes": 8322998272
},
"target": {
"kind": "emulator",
"name": "sdk_gphone_x86_64",
"identifier": "emulator-5554",
"operatingSystem": "Android",
"operatingSystemVersion": "11",
"apiLevel": 30,
"architecture": "x86_64",
"supportedArchitectures": [
"x86_64",
"x86",
"arm64-v8a",
"armeabi-v7a",
"armeabi"
],
"manufacturer": "Google",
"model": "sdk_gphone_x86_64",
"productName": "sdk_gphone_x86_64",
"buildFingerprint": "google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys",
"cpuModel": "0",
"cpuMaxFrequencyHertz": 2000,
"totalMemoryBytes": 2077544448
}
}
}
<<XHARNESS_RESULT_END>>
info: Attempting to remove apk 'com.microsoft.maui.core.devicetests'..
info: Successfully uninstalled com.microsoft.maui.core.devicetests
XHarness exit code: 1 (TESTS_FAILED)
Passed: 0
Failed: 1
Skipped: 0
Total: 1
Tests completed with exit code: 1
🟢 With fix — 📱 EntryHandlerTests (NumericKeyboardAcceptsPolishDecimalSeparator): PASS ✅ · 378s
(no coded error found; showing last 1200 chars)
194000,
"totalMemoryBytes": 8322998272
},
"target": {
"kind": "emulator",
"name": "sdk_gphone_x86_64",
"identifier": "emulator-5554",
"operatingSystem": "Android",
"operatingSystemVersion": "11",
"apiLevel": 30,
"architecture": "x86_64",
"supportedArchitectures": [
"x86_64",
"x86",
"arm64-v8a",
"armeabi-v7a",
"armeabi"
],
"manufacturer": "Google",
"model": "sdk_gphone_x86_64",
"productName": "sdk_gphone_x86_64",
"buildFingerprint": "google/sdk_gphone_x86_64/generic_x86_64_arm64:11/RSR1.201211.001/7027799:user/release-keys",
"cpuModel": "0",
"cpuMaxFrequencyHertz": 2000,
"totalMemoryBytes": 2077544448
}
}
}
<<XHARNESS_RESULT_END>>
info: Attempting to remove apk 'com.microsoft.maui.core.devicetests'..
info: Successfully uninstalled com.microsoft.maui.core.devicetests
XHarness exit code: 0
Passed: 1
Failed: 0
Skipped: 0
Total: 1
Tests completed successfully
📁 Fix files reverted (1 files)
src/Core/src/Platform/Android/EditTextExtensions.cs
📋 Pre-Flight — Context & Validation
Issue: #38213 - [Android] Keyboard="Numeric" Entry no longer accepts OS-locale decimal separator (e.g. comma in PL)
PR: #38485 - [main] [Android] Fix Keyboard="Numeric" Entry no longer accepts OS-locale decimal separator
Platforms Affected: Android
Files Changed: 1 implementation, 1 test
Key Findings
SetInputTypefirst installsLocalizedDigitsKeyListenerforKeyboard.Numeric, then the non-password branch writesEditText.InputTypeagain while clearing password variation bits.- Android's
TextView.setInputType()recreates the key listener. On a numeric field this replaces MAUI's localized listener with Android's defaultDigitsKeyListener, so locale-specific separators such as Polish,are filtered out. - The PR avoids the redundant setter call by clearing a password variation only when that variation is present. The gate independently demonstrated that
NumericKeyboardAcceptsPolishDecimalSeparatorfails at the merge base and passes with the PR. - The implementation path also handles password transitions and every numeric
Entry; alternatives must preserve numeric-password behavior and the numeric class/decimal/signed flags. - No mandatory regression tests were supplied beyond the detected primary test. STEP 5a is therefore restricted to the verified
CoreAndroid device-test filterCategory=Entry.
Code Review Summary
Verdict: SKIPPED
Confidence: N/A
Errors: 0 | Warnings: 0 | Suggestions: 0
The dedicated expert/code-review pass is intentionally deferred to STEP 5b. No expert-review agent was launched during this candidate-generation phase.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #38485 | Guard password-variation removal so unchanged numeric input types are not reassigned | ✅ PASSED (Gate) | EditTextExtensions.cs |
Original PR; test added separately |
🔬 Code Review — Deep Analysis
Expert PR Evaluation
Verdict: LGTM (code-level)
Confidence: Medium
The submitted Android fix is sound. SetInputType now avoids reassigning EditText.InputType when the relevant password variation flag is already absent. This preserves the LocalizedDigitsKeyListener installed for Keyboard.Numeric, preventing Android's setInputType() path from replacing it with a non-localized DigitsKeyListener.
The added device test directly covers the reported Polish-culture failure by committing 1,5 through the input connection and verifying the localized listener and numeric input flags. The trusted Gate confirms that this regression test fails without the fix and passes with it.
Actionable inline findings: None. inline-findings.json contains an empty JSON array.
Non-blocking improvement: Add adjacent coverage for a numeric Entry transitioning from password mode to plain mode, then accepting a locale-specific decimal separator. This would protect the nearby state-transition path without changing the submitted production fix.
🛠️ Try-Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | gpt-5.3-codex / try-fix |
Move the numeric LocalizedDigitsKeyListener assignment after all InputType mutations, repairing any listener replacement |
⛔ BLOCKED | 0 | Baseline rejected pre-existing dirty harness files; no implementation or test run |
| 2 | gpt-5.6-sol / try-fix |
Use Android SetRawInputType for class-scoped password-bit removal so the existing localized listener is preserved |
⛔ BLOCKED | 0 | Proposed diff recorded, but baseline rejected pre-existing dirty harness files before it could be applied or tested |
| PR | PR #38485 | Guard password-variation removal so unchanged numeric input types are not reassigned | ✅ PASSED (Gate) | 1 implementation + 1 test | Original PR |
Candidate 1 Detail
- Result: Blocked before implementation.
- Difference from PR: Repairs the listener after setter side effects instead of suppressing redundant setter calls.
- Candidate diff: None; baseline establishment failed.
- Test: Not run.
- Failure analysis:
EstablishBrokenBaseline.ps1reportedDIRTY WORKING DIRECTORYbecause the shared worktree contains pre-existing tracked harness modifications. Required safety rules prohibited editing without a baseline. - Artifacts:
try-fix-1/content.md,try-fix/attempt-1/.
Candidate 2 Detail
- Result: Blocked before implementation.
- Difference from PR and candidate 1: Uses Android's raw input-type API to preserve the installed listener; it neither conditionally suppresses setter writes nor repairs the listener afterward.
- Proposed diff: Replace the two unconditional non-password
InputType &= ~...Passwordwrites with class-scopedSetRawInputType(editText.InputType & ~...Password)calls. The exact proposed diff is preserved intry-fix-2/content.md; the appliedfix.diffis empty because baseline establishment failed. - Test command:
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform android -TestFilter "Category=Entry" - Test: Not run (0 executions).
- Inline self-review: Completed with 0 findings, design-only because no diff was applied.
- Failure analysis:
EstablishBrokenBaseline.ps1reportedDIRTY WORKING DIRECTORYfor the same pre-existing tracked harness modifications. Safety rules prohibited cleaning the shared worktree or editing without a baseline. - Artifacts:
try-fix-2/content.md,try-fix/attempt-2/.
Comparison and Selection
| Option | Mechanism | Empirical Evidence | Selection |
|---|---|---|---|
| Candidate 1 | Reapply localized listener after final input-type mutation | None; blocked before edit/test | Not selectable |
| Candidate 2 | Clear password bits with SetRawInputType, preserving the listener |
None; blocked before edit/test | Not selectable |
| PR #38485 | Avoid unchanged InputType setter calls with password-variation guards |
Gate: regression fails without fix and passes with fix | Selected |
The original PR remains the only empirically validated implementation. Both alternatives are bounded, distinct design candidates for STEP 5b consideration, but neither should replace the PR without a clean-baseline implementation and Android device-test run.
📝 PR Finalize — Recommended Title & Description
Assessment: ✏️ Recommend updating — the current description identifies the backport but omits the Android root cause, submitted fix, regression test, platform scope, and fixed issue.
Recommended title
[Android] Entry: Accept OS-locale decimal separators with Keyboard.Numeric
Recommended description
Backport of #38277 to `main`.
### Description of Change
On Android, `EditTextExtensions.SetInputType` installs `LocalizedDigitsKeyListener` for `Keyboard.Numeric`, but the non-password path redundantly writes `EditText.InputType` while clearing password variation flags that are already absent. Android's `TextView.setInputType()` then replaces the localized key listener, causing locale-specific decimal separators such as the Polish comma to be rejected.
Update `SetInputType` to clear `TextVariationPassword` and `NumberVariationPassword` only when the corresponding input class and password variation flag are present. This avoids unnecessary `InputType` setter calls and preserves localized numeric input.
Add the Android device test `NumericKeyboardAcceptsPolishDecimalSeparator`, which commits `1,5` under `pl-PL` and verifies the localized key listener and numeric input flags.
### Issues Fixed
Fixes #38213
### Platforms Tested
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac
/cc @kubaflo @HarishwaranVijayakumar
🏁 Report — Final Recommendation
✅ Final Recommendation: APPROVE
Winner: pr
The submitted PR is the strongest candidate. Its narrowly scoped production guard prevents redundant Android InputType setter calls from replacing LocalizedDigitsKeyListener, and the trusted Gate proves the targeted regression test fails at the PR base and passes with the submitted fix. The expert reviewer found no blocking errors or discussion items.
Comparative ranking
| Rank | Candidate | Production approach | Regression evidence | Assessment |
|---|---|---|---|---|
| 1 | pr |
Clear password variation flags only when the matching class and variation flags are present, avoiding the destructive no-op setter call | ✅ Trusted Gate: targeted test fails without the fix and passes with it | Winner. Minimal, directly addresses the Android side effect, and includes sufficient regression coverage. |
| 2 | pr-plus-reviewer |
Same production fix as pr; adds password-to-plain locale-decimal coverage |
✅ Category=Entry: 242 selected, 240 passed, 0 failed, 2 ignored |
Safe and fully validated, but the additional test is non-blocking and largely overlaps the submitted locale-decimal test plus the existing password-toggle test. It does not improve the production solution enough to displace the leaner PR. |
| 3 | try-fix-1 |
Reapply LocalizedDigitsKeyListener after all InputType mutations |
⛔ Blocked before implementation; no test run | Conceptually viable but has no applied diff or empirical evidence, so it ranks below both passing candidates. |
| 4 | try-fix-2 |
Use SetRawInputType for class-scoped password-bit removal |
⛔ Blocked before implementation; no test run | Also unverified, and changes the Android API mechanism more broadly than the submitted conditional guard. |
Expert review
- Verdict: LGTM (code-level), medium confidence due to Android input/handler plumbing.
- Inline findings: none (
inline-findings.jsonis[]). - The suggested adjacent transition test was evaluated as
pr-plus-reviewerand passed, but remains optional rather than merge-blocking.
Decision
Approve the raw submitted PR. The Gate permits approval, the expert review found no blocking or discussion-level issue, and no alternative has stronger production behavior or evidence. The two STEP 5a alternatives are blocked and untested; pr-plus-reviewer adds redundant coverage without changing the already-correct fix.
🔗 Regression Cross-Reference
🔍 Regression Cross-Reference
⚠ Overlaps with prior bug-fix PRs — same files modified, but no exact line revert detected.
📱 UI Tests — ViewBaseTests
Detected UI test categories: ViewBaseTests
ViewBaseTests) started (the HostApp built and dotnet test launched) but produced no results — the app failed to launch or the test host crashed before a .trx was written (an app-launch/Appium failure or an emulator flake). These categories exited quickly, well under their time budget, so raising the budget will not help — re-run the review to try again. If it recurs, check the build-output.log + logcat in the drop-deep-uitests artifact for an app-startup crash.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
Backport of #38277 to main
/cc @kubaflo @HarishwaranVijayakumar