Repository navigation
[Android]Fix keyboard-type flicker when replacing focused ContentView content - #40169
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 40169Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 40169" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/rebase |
|
Unable to rebase this branch automatically. It may have conflicts with its base branch, or the PR author has not allowed maintainer edits. Please rebase manually. |
| if (PlatformView is null || VirtualView is null) | ||
| return; | ||
|
|
||
| PlatformView.UpdateKeyboard(VirtualView); |
There was a problem hiding this comment.
[moderate] Handler Mapper and Property Patterns - Reapplying the keyboard here overwrites custom numeric KeyListeners after mapper initialization. UpdateKeyboard calls SetInputType, which unconditionally installs LocalizedDigitsKeyListener for Keyboard.Numeric, without rerunning the customization. The existing Issue21109DecimalEntry is a concrete affected case: its AppendToMapping installs Issue21109NumericKeyListener before attachment, but this callback replaces it, losing its accepted characters and OnKeyDown handling and regressing the scenario addressed by #22546. Preserve the installed customization when refreshing the keyboard. The new attachment-time call in EntryHandler2 has the same mapper-bypass problem.
PR Test Gate
🧪 Gate analysis — click to expand✅ Passed. The selected verification satisfied the gate's passing conditions. Unmatched, skipped, or inconclusive groups are not passing evidence. 🖥 UI tests
Execution log excerptsWithout fix With fix PR head: 26065376. Without-fix baseline: 9291bfb2. |
This comment has been minimized.
This comment has been minimized.
|
/rebase |
c2aaa00 to
bbe3f21
Compare
This comment has been minimized.
This comment has been minimized.
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 12051ee.
This comment has been minimized.
This comment has been minimized.
PR Test Gate
🧪 Gate analysis — click to expand⚠ Inconclusive. Setup, build, or execution did not produce a conclusive result. This does not prove the fix is incorrect. No interpretable test-group summary was produced. No additional test execution is inferred. Setup did not capture a verified PR head; no commit is claimed as tested. No immutable without-fix baseline was prepared. |
There was a problem hiding this comment.
Expert Review — 0 findings
Reviewed commit 12051ee.
… content (dotnet#40169) <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Issue Description On Android 16, switching between Entries with different keyboard types can briefly display the previous keyboard layout before showing the correct one, causing visible flickering. In the reproduction, each Entry is dynamically added to a ContentView and replaced with a Label when another cell is selected. ### Root Cause RemoveAllViews() detached the focused native EditText without explicitly clearing its focus. Removing a view is not the same as completing a focus transition. Android updates the keyboard through its input-method system asynchronously. If the outgoing text field is still considered the active input target, the keyboard can temporarily retain its configuration while Android processes detachment, transfers focus, and establishes the incoming Entry’s input connection. ### Description of Change - Clear native focus from the outgoing ContentView content before calling RemoveAllViews() on Android. - Previously, removing content containing a focused Entry could leave stale input-method state. When switching between Entries with different keyboard types, the previous keyboard layout could briefly appear before the correct layout. - Explicitly clearing focus before removing the native view ensures that the outgoing Entry relinquishes focus before the next Entry is attached and focused. ### Issues Fixed Fixes dotnet#38799 ### Tested the behaviour in the following platforms - [x] Android - [ ] Windows - [ ] iOS - [ ] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="300" height="600" alt="Before Fix" src="https://github.com/user-attachments/assets/62b49b56-86e3-48e8-9ae1-19e92106f5b0">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/55caabe9-2021-43c0-9407-31bbad08db4c">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… content (dotnet#40169) <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Issue Description On Android 16, switching between Entries with different keyboard types can briefly display the previous keyboard layout before showing the correct one, causing visible flickering. In the reproduction, each Entry is dynamically added to a ContentView and replaced with a Label when another cell is selected. ### Root Cause RemoveAllViews() detached the focused native EditText without explicitly clearing its focus. Removing a view is not the same as completing a focus transition. Android updates the keyboard through its input-method system asynchronously. If the outgoing text field is still considered the active input target, the keyboard can temporarily retain its configuration while Android processes detachment, transfers focus, and establishes the incoming Entry’s input connection. ### Description of Change - Clear native focus from the outgoing ContentView content before calling RemoveAllViews() on Android. - Previously, removing content containing a focused Entry could leave stale input-method state. When switching between Entries with different keyboard types, the previous keyboard layout could briefly appear before the correct layout. - Explicitly clearing focus before removing the native view ensures that the outgoing Entry relinquishes focus before the next Entry is attached and focused. ### Issues Fixed Fixes dotnet#38799 ### Tested the behaviour in the following platforms - [x] Android - [ ] Windows - [ ] iOS - [ ] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="300" height="600" alt="Before Fix" src="https://github.com/user-attachments/assets/62b49b56-86e3-48e8-9ae1-19e92106f5b0">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/55caabe9-2021-43c0-9407-31bbad08db4c">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… content (dotnet#40169) <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Issue Description On Android 16, switching between Entries with different keyboard types can briefly display the previous keyboard layout before showing the correct one, causing visible flickering. In the reproduction, each Entry is dynamically added to a ContentView and replaced with a Label when another cell is selected. ### Root Cause RemoveAllViews() detached the focused native EditText without explicitly clearing its focus. Removing a view is not the same as completing a focus transition. Android updates the keyboard through its input-method system asynchronously. If the outgoing text field is still considered the active input target, the keyboard can temporarily retain its configuration while Android processes detachment, transfers focus, and establishes the incoming Entry’s input connection. ### Description of Change - Clear native focus from the outgoing ContentView content before calling RemoveAllViews() on Android. - Previously, removing content containing a focused Entry could leave stale input-method state. When switching between Entries with different keyboard types, the previous keyboard layout could briefly appear before the correct layout. - Explicitly clearing focus before removing the native view ensures that the outgoing Entry relinquishes focus before the next Entry is attached and focused. ### Issues Fixed Fixes dotnet#38799 ### Tested the behaviour in the following platforms - [x] Android - [ ] Windows - [ ] iOS - [ ] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="300" height="600" alt="Before Fix" src="https://github.com/user-attachments/assets/62b49b56-86e3-48e8-9ae1-19e92106f5b0">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/55caabe9-2021-43c0-9407-31bbad08db4c">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… content (dotnet#40169) <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Issue Description On Android 16, switching between Entries with different keyboard types can briefly display the previous keyboard layout before showing the correct one, causing visible flickering. In the reproduction, each Entry is dynamically added to a ContentView and replaced with a Label when another cell is selected. ### Root Cause RemoveAllViews() detached the focused native EditText without explicitly clearing its focus. Removing a view is not the same as completing a focus transition. Android updates the keyboard through its input-method system asynchronously. If the outgoing text field is still considered the active input target, the keyboard can temporarily retain its configuration while Android processes detachment, transfers focus, and establishes the incoming Entry’s input connection. ### Description of Change - Clear native focus from the outgoing ContentView content before calling RemoveAllViews() on Android. - Previously, removing content containing a focused Entry could leave stale input-method state. When switching between Entries with different keyboard types, the previous keyboard layout could briefly appear before the correct layout. - Explicitly clearing focus before removing the native view ensures that the outgoing Entry relinquishes focus before the next Entry is attached and focused. ### Issues Fixed Fixes dotnet#38799 ### Tested the behaviour in the following platforms - [x] Android - [ ] Windows - [ ] iOS - [ ] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="300" height="600" alt="Before Fix" src="https://github.com/user-attachments/assets/62b49b56-86e3-48e8-9ae1-19e92106f5b0">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/55caabe9-2021-43c0-9407-31bbad08db4c">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
… content (dotnet#40169) <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [ ] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. ### Issue Description On Android 16, switching between Entries with different keyboard types can briefly display the previous keyboard layout before showing the correct one, causing visible flickering. In the reproduction, each Entry is dynamically added to a ContentView and replaced with a Label when another cell is selected. ### Root Cause RemoveAllViews() detached the focused native EditText without explicitly clearing its focus. Removing a view is not the same as completing a focus transition. Android updates the keyboard through its input-method system asynchronously. If the outgoing text field is still considered the active input target, the keyboard can temporarily retain its configuration while Android processes detachment, transfers focus, and establishes the incoming Entry’s input connection. ### Description of Change - Clear native focus from the outgoing ContentView content before calling RemoveAllViews() on Android. - Previously, removing content containing a focused Entry could leave stale input-method state. When switching between Entries with different keyboard types, the previous keyboard layout could briefly appear before the correct layout. - Explicitly clearing focus before removing the native view ensures that the outgoing Entry relinquishes focus before the next Entry is attached and focused. ### Issues Fixed Fixes dotnet#38799 ### Tested the behaviour in the following platforms - [x] Android - [ ] Windows - [ ] iOS - [ ] Mac ### Output Screenshot Before Issue Fix | After Issue Fix | |----------|----------| |<video width="300" height="600" alt="Before Fix" src="https://github.com/user-attachments/assets/62b49b56-86e3-48e8-9ae1-19e92106f5b0">|<video width="100" height="100" alt="After Fix" src="https://github.com/user-attachments/assets/55caabe9-2021-43c0-9407-31bbad08db4c">| Co-authored-by: Jakub Florkowski <kubaflo123@gmail.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for #40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** #40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; #40191 is the preceding focusability change, not a duplicate repair. #40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to #40116 and #40191. Repairs the independent Editor timeout observed in the validation of #40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
<!-- 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! <!-- Open .NET 11 fix PRs against net11 for review; target main for next-major features. After approval, a maintainer manually retargets the fix PR to the active inflight branch and merges it directly there. Do not merge individual fixes into net11. Bots must not retarget or merge. Candidate integration into net11 and release/* changes are separate, explicitly coordinated release work. --> ### Target Branch | This PR is for | Initial base | | --- | --- | | New features, API changes, or .NET 12 work (including .NET 12 fixes) | `main` | | .NET 11 servicing fixes | `net11`, for review | | Older servicing, release integration, infrastructure, or documentation | The branch designated for that work | - [x] I selected the applicable base branch using the [contribution guide](https://github.com/dotnet/maui/blob/main/.github/CONTRIBUTING.md#choose-your-pr-base-before-starting). For .NET 11 fixes, only a maintainer retargets the approved PR to the active inflight lane and merges it after CI validates that final base. Do not merge individual fixes directly into `net11`; agents must not retarget or merge. This is an explicitly coordinated release-candidate repair for dotnet#40116, targeting the designated `candidate/11.0.1xx-sr2` branch. ### Description of Change <!-- Enter description of the fix in this section --> Only post the explicit soft-keyboard request from `TextViewExtensions.Focus` when Android's native `OnCheckIsTextEditor()` returns true, while preserving the existing `ShowSoftInputOnFocus` check and normal focus request. **Root cause:** dotnet#40191 intentionally keeps read-only inputs focusable and hides an existing keyboard in the native focus-change handler. However, the shared programmatic-focus callback subsequently posts `ShowSoftInput` even when the native input has `KeyListener = null`, `InputType = 0`, and `OnCheckIsTextEditor() == false`. This reopens the keyboard. In the unchanged `VerifyEditorSelectionLengthWhenIsReadOnlyTrue` test, the sample's Update Cursor Selection button programmatically focuses the read-only Editor; the keyboard then obscures `SelectionLengthEntry`, causing the timeout at line 480. Native tracing on API 30 confirmed the Editor is genuinely read-only and remains focusable/focused while the IME changes from hidden to visible. A diagnostic-only control removing the explicit keyboard-show trigger clears the unchanged test. The fix does not revert read-only focusability or alter cursor/selection mapping. No timeouts, retry budgets, filters, or screenshot tolerances are changed; existing assertions are retained and focus assertions are added. Extend the existing Issue6250 page/tests rather than adding a fixture: exercise touch and programmatic focus for read-only Entry, Editor, and SearchBar. Each case first proves an editable Entry shows the keyboard; the programmatic cases use `Focus()` for that positive control too. All cases assert that the intended read-only control actually receives focus and the keyboard disappears. The original Editor feature tests remain unchanged. **Local causal validation:** Android API 30, Nexus 5X, 1080x1920, 420 dpi, ARM64, CoreCLR 11.0.0, SDK 11.0.100. | Phase | Result | | --- | --- | | Unchanged original read-only Editor pair | Selection-length case times out at the same line as CI; cursor-position case passes | | Diagnostic trigger-removed control | Original pair: 2 passed | | Fix applied | Original pair plus six focus cases: 8 passed | | Only production guard reverted, final test bodies retained | 4 failed / 4 passed: original selection timeout and all three read-only programmatic cases fail | | Guard restored, no diagnostic app instrumentation | Same eight cases: 8 passed | | Expanded selector including both Editor fixture names and Issue6250 | 93 total: 62 passed, 3 existing skips, 28 failed solely because Material3 API-30 baseline snapshots are absent; no snapshots or filters changed | | Pushed commit rebuilt and identical expanded selector repeated | 93 total: 62 passed, 3 existing skips, 28 missing-baseline failures; original Editor fixture 56 passed / 3 skips and Issue6250 6 passed | Within that expanded run, the original Editor fixture is **56 passed / 3 existing skips** and Issue6250 is **6 passed**. The Material3 failures are explicit validation limitations, not a green full-suite claim: those snapshots exist under `android-notch-36`, not the API-30 `android` directory. The failing CI environment uses x86_64/CoreCLR 11.0.1/servicing SDK 11.0.101. Local ARM64 validation is not a claim that the exact CI runtime or other platforms have passed. CI requests remain with the coordinating maintainer/session. No manual CI or review triggers were submitted. Searched open and recently merged PRs for the failure, native text-editor check, and explicit keyboard-show mechanism; dotnet#40191 is the preceding focusability change, not a duplicate repair. dotnet#40169 changes ContentView handling, not this focus path. #### Exact commands and results Run from the repository root using the local SDK/runtime and owned emulator described above. Absolute paths below identify retained diagnostic results; none of those diagnostic files is part of the PR. **Passed: 0 warnings, 0 errors.** ```bash dotnet build Microsoft.Maui.BuildTasks.slnf -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors.** ```bash dotnet build src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj -c Debug -f net11.0-android -p:RuntimeIdentifier=android-arm64 -p:EmbedAssembliesIntoApk=true -p:UseMonoRuntime=false -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -v:q ``` **Passed, including the post-push build: 0 warnings, 0 errors. The external targets file changes only the task-owned Appium endpoint.** ```bash dotnet build src/Controls/tests/TestCases.Android.Tests/Controls.TestCases.Android.Tests.csproj -c Debug -p:IncludeAndroidTargetFrameworks=true -p:IncludeIosTargetFrameworks=false -p:IncludeMacCatalystTargetFrameworks=false -p:IncludeMacOSTargetFrameworks=false -p:IncludeWindowsTargetFrameworks=false -p:CustomAfterMicrosoftCommonTargets=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/private-appium.targets -v:q ``` **Passed (exit 0); only these three changed C# files were included.** ```bash dotnet format Microsoft.Maui.sln --no-restore --exclude Templates/src --exclude-diagnostics CA1822 --include src/Core/src/Platform/Android/TextViewExtensions.cs src/Controls/tests/TestCases.HostApp/Issues/Issue6250.cs src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue6250.cs --verbosity quiet ``` **Expected red with only the production guard removed: 4 failed / 4 passed / 0 skipped.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-reverted.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-reverted ``` **Guard restored: 8 passed / 0 failed / 0 skipped, including editable programmatic-focus positive controls.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~VerifyEditorSelectionLengthWhenIsReadOnlyTrue|FullyQualifiedName~VerifyEditorCursorPositionWhenIsReadOnlyTrue|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=final-restored.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/final-restored ``` **Post-push full selector on a401a45: exit 1, 62 passed / 28 failed / 3 existing skips / 93 total. Every failure is a missing API-30 Material3 baseline; none is silently excluded.** ```bash DEVICE_UDID=emulator-5576 ANDROID_SERIAL=emulator-5576 PLATFORM_VERSION=11 DEVICE_SKIN='Nexus 5X' APPIUM_LOG_FILE=/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush-appium.log dotnet vstest artifacts/bin/Controls.TestCases.Android.Tests/Debug/net11.0/Controls.TestCases.Android.Tests.dll '--TestCaseFilter:FullyQualifiedName~EditorFeatureTests|FullyQualifiedName~Microsoft.Maui.TestCases.Tests.Issues.Issue6250' '--logger:trx;LogFileName=postpush.trx' --ResultsDirectory:/Users/kubaflo/.copilot/session-state/36c25d54-6d5a-4e42-8ee0-23fc24260ce9/files/postpush ``` ### 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. --> Relates to dotnet#40116 and dotnet#40191. Repairs the independent Editor timeout observed in the validation of dotnet#40248; it does not change Issue7556 or attribute this failure to that PR's implementation. <!-- Verify the target branch follows the release workflow in docs/ReleaseBranchWorkflow.md. Infrastructure and documentation changes should target the branch where they apply. --> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Target Branch
mainnet11, for reviewFor .NET 11 fixes, only a maintainer retargets the approved PR to the active
inflight lane and merges it after CI validates that final base. Do not merge
individual fixes directly into
net11; agents must not retarget or merge.Issue Description
On Android 16, switching between Entries with different keyboard types can briefly display the previous keyboard layout before showing the correct one, causing visible flickering. In the reproduction, each Entry is dynamically added to a ContentView and replaced with a Label when another cell is selected.
Root Cause
RemoveAllViews() detached the focused native EditText without explicitly clearing its focus. Removing a view is not the same as completing a focus transition.
Android updates the keyboard through its input-method system asynchronously. If the outgoing text field is still considered the active input target, the keyboard can temporarily retain its configuration while Android processes detachment, transfers focus, and establishes the incoming Entry’s input connection.
Description of Change
Issues Fixed
Fixes #38799
Tested the behaviour in the following platforms
Output Screenshot
Screen.Recording.2026-11-12.at.3.09.04.PM.mov
Screen.Recording.2026-11-12.at.3.07.00.PM.mov