Skip to content

[main] [Android] Fix Keyboard="Numeric" Entry no longer accepts OS-locale decimal separator - #38485

Merged
kubaflo merged 1 commit into
mainfrom
backport/pr-38277-to-main
Sep 12, 2026
Merged

kubaflo merged 1 commit into
mainfrom
backport/pr-38277-to-main

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Backport of #38277 to main

/cc @kubaflo @HarishwaranVijayakumar

…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

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Sep 12, 2026
@kubaflo
kubaflo merged commit 39b187a into main Sep 12, 2026
2 of 12 checks passed
@kubaflo
kubaflo deleted the backport/pr-38277-to-main branch September 12, 2026 17:02
@github-actions github-actions Bot added this to the .NET 10 SR12 milestone Sep 12, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@github-actions[bot] — new AI review results are available based on commit d931be9.

Gate Passed Confidence Medium Platform Android


🗂️ 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

  • SetInputType first installs LocalizedDigitsKeyListener for Keyboard.Numeric, then the non-password branch writes EditText.InputType again 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 default DigitsKeyListener, 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 NumericKeyboardAcceptsPolishDecimalSeparator fails 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 Core Android device-test filter Category=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.ps1 reported DIRTY WORKING DIRECTORY because 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 &= ~...Password writes with class-scoped SetRawInputType(editText.InputType & ~...Password) calls. The exact proposed diff is preserved in try-fix-2/content.md; the applied fix.diff is 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.ps1 reported DIRTY WORKING DIRECTORY for 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.json is []).
  • The suggested adjacent transition test was evaluated as pr-plus-reviewer and 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.

File Fix PR Fixed issue(s)
src/Core/src/Platform/Android/EditTextExtensions.cs #34617 #6972, #8422, #10107, #10509, #11113, #11677, #11808, #11812, #12131, #12324, #14566, #15057, #15280, #15559, #16522, #17127, #17323, #17550, #17664, #17864, #18367, #18481, #18669, #18679, #18843, #18933, #19074, #19219, #19331, #19642, #20383, #20392, #20596, #20682, #20855, #20922, #21037, #21240, #21646, #21700, #21791, #21828, #22060, #22565, #22887, #23030, #23832, #23903, #24241, #24252, #24511, #24603, #24866, #25010, #25081, #25093, #25728, #25920, #25921, #26158, #26633, #26864, #26975, #27143, #27250, #27302, #27427, #27646, #27846, #28078, #28101, #28147, #28421, #28722, #28824, #28901, #28961, #29191, #29192, #29415, #29428, #29484, #29547, #29645, #29704, #29729, #29764, #29812, #29930, #30004, #30066, #30097, #30181, #30273, #30290, #30605, #30782, #30888, #30979, #31109, #31121, #31140, #31145, #31387, #31551, #31966, #32017, #32243, #32266, #32316, #32406, #32416, #32578, #32791, #32807, #32983, #32989, #32995, #33119, #33131, #33258, #33291, #33293, #33304, #33375, #33415, #33417, #33420, #33424, #33493, #33547, #33577, #33601, #33604, #33614, #33635, #33648, #33650, #33672, #33706, #33769, #33772, #33904, #33909, #33947, #33954, #33964, #33969, #33972, #34021, #34073, #34114, #34119, #34122, #34165, #34210, #34211, #34246, #34257, #34336, #34343, #34419, #34464, #34480, #34591, #34635, #34636, #34661

📱 UI Tests — ViewBaseTests

Detected UI test categories: ViewBaseTests

⚠️ Deep UI tests — The deep UI run for 1 category (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.

@MauiBot MauiBot added s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) and removed s/agent-review-in-progress AI review is currently running for this PR labels Sep 12, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 13, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

s/agent-approved AI agent recommends approval - PR fix is correct and optimal s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants