Repository navigation
[Android] Fix Keyboard="Numeric" Entry no longer accepts OS-locale decimal separator - #38277
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 38277Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 38277" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@HarishwaranVijayakumar! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
🟢 Approval recommended
The change is narrowly scoped, aligns with the described root cause, and includes a focused regression test that verifies both behavior and the correct KeyListener is retained.
Pull request overview
This PR fixes an Android regression where Entry with Keyboard.Numeric stops accepting the OS/app-locale decimal separator (e.g., , in pl-PL) because a redundant InputType assignment causes Android to recreate the KeyListener, replacing MAUI’s LocalizedDigitsKeyListener.
Changes:
- Updated Android
EditTextExtensions.SetInputTypeto only clear password-variation flags when they’re actually present, avoiding unnecessaryInputTypesetter calls that reset the numericKeyListener. - Added an Android device test to validate that under
pl-PL, numeric input accepts,and thatLocalizedDigitsKeyListenerremains installed.
File summaries
| File | Description |
|---|---|
| src/Core/tests/DeviceTests/Handlers/Entry/EntryHandlerTests.Android.cs | Adds a regression device test for Polish decimal separator acceptance and verifies LocalizedDigitsKeyListener + numeric input flags. |
| src/Core/src/Platform/Android/EditTextExtensions.cs | Prevents unnecessary InputType setter invocation when password-variation flags aren’t set, preserving the localized numeric KeyListener. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
Preserve the locale-aware numeric Entry regression test alongside the newly added Android accessibility coverage. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 169298fa-95aa-47a4-ad1c-512dc3f97871
Bring in the latest GradientBrush lifecycle fix after resolving the Entry test conflict. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 169298fa-95aa-47a4-ad1c-512dc3f97871
|
Resolved the conflicts against the latest The conflict in The Android Core device-test app built successfully, and the Entry-filtered run completed with 241 tests: 239 passed, 2 ignored, and 0 failed. |
…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
…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
…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
…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
|
/backport to release/10.0.1xx-sr11 |
|
Started backporting to |
|
/backport to main |
|
Started backporting to |
…cale decimal separator (#38485) Backport of #38277 to main /cc @kubaflo @HarishwaranVijayakumar Co-authored-by: HarishwaranVijayakumar <harishwaran.vijayakumar@syncfusion.com> 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
…ger accepts OS-locale decimal separator (#38483) Backport of #38277 to release/10.0.1xx-sr11 /cc @kubaflo @HarishwaranVijayakumar Co-authored-by: HarishwaranVijayakumar <harishwaran.vijayakumar@syncfusion.com> 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
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!
Issue Details:
For example, under Polish culture, pressing , after 1 is ignored instead of producing 1, .
Root Cause of the issue:
Description of Change
Localization and Numeric Keyboard Support:
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:
SetInputTypeinEditTextExtensions.csto 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
Fixes #38213
Tested the behavior in the following platforms
Output
Beforefix-38213.mov
Afterfix-38213.mov