[iOS] Fixed the flyout icon and content page disappeared when focus on the shell search handler#28474
Conversation
|
Hey there @NanthiniMahalingam! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Pull Request Overview
This PR addresses issue #22060 by ensuring that the flyout icon and content page title reappear after interacting with the iOS search controller.
- Removed the manual setting of ShowsCancelButton in iOS SearchHandlerAppearanceTracker.
- Added UI tests in TestCases.Shared.Tests to verify the fix.
- Updated the Shell sample in TestCases.HostApp to integrate the new search behavior.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22060.cs | Added a UI test to verify flyout icon and content page title reappear on cancel. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue22060.cs | Updated Shell sample with the new SearchHandler configuration. |
| src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs | Removed the explicit setting of ShowsCancelButton to false, relying on automaticallyShowsCancelButton instead. |
Comments suppressed due to low confidence (1)
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs:40
- The removal of setting ShowsCancelButton to false is correct based on the new behavior. Please ensure that automaticallyShowsCancelButton is consistently handling the cancel button appearance across all scenarios on iOS.
_uiSearchBar.ShowsCancelButton = false;
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| @@ -0,0 +1,26 @@ | |||
| #if IOS // Flyout icon and content page title disappeared when focus on the search handler in iOS platform alone | |||
There was a problem hiding this comment.
Is fine, although it would be nice to run the test on all the platforms. You'd need queries for each case, though.
There was a problem hiding this comment.
Hi @jsuarezruiz
Yes, I have added queries for each platform and included test cases for all platforms.
|
@NanthiniMahalingam Could you rebase and fix the conflict? Thanks in advance. |
1328dbd to
2b06766
Compare
Hi @jsuarezruiz, Rebased and resolved the conflict. |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
jsuarezruiz
left a comment
There was a problem hiding this comment.
The build of the UITest HostApp is failing:
D:\a\1\s\src\Controls\tests\TestCases.Shared.Tests\Tests\Issues\Issue22060.cs(20,7): error CS1061: 'IApp' does not contain a definition for 'EnterTextInShellSearchHandler' and no accessible extension method 'EnterTextInShellSearchHandler' accepting a first argument of type 'IApp' could be found (are you missing a using directive or an assembly reference?) [D:\a\1\s\src\Controls\tests\TestCases.WinUI.Tests\Controls.TestCases.WinUI.Tests.csproj]
1 Error(s)
Could you review it?
Hi @jsuarezruiz , I've resolved the build error, and the UITest HostApp is now in a runnable state. |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| [Test] | ||
| [Category(UITestCategories.Shell)] | ||
| [Category(UITestCategories.SearchBar)] | ||
| public void ShouldAppearFlyoutIconAndContentPageTitle() |
There was a problem hiding this comment.
Pending snapshot already available in the latest build.
Could you commit the images?
There was a problem hiding this comment.
Pending snapshot already available in the latest build. Could you commit the images?
Hi @jsuarezruiz ,
The pending snapshots have been added.
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
dd37a86 to
48ed549
Compare
48ed549 to
200ec55
Compare
…search handler and added the test case
200ec55 to
81d2fe8
Compare
🤖 AI Summary📊 Expand Full Review —
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #28474 | Remove the forced ShowsCancelButton = false behavior so iOS can show Cancel and restore Shell chrome; add issue page and screenshot UITest PENDING (Gate) |
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs, src/TestUtils/src/UITest.Appium/HelperExtensions.cs, src/Controls/tests/TestCases.HostApp/Issues/Issue22060.cs, src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue22060.cs |
Original PR | coverage. |
Issue: #22060 - [iOS] Flyout button and title disappears after focusing shell search
PR: #28474 - [iOS] Fixed the flyout icon and content page disappeared when focus on the shell search handler
Platforms Affected: iOS (runtime bug); test snapshots also added for Android, Windows, Mac
Files Changed: 2 implementation (fix + helper), 2 test, 4 snapshot
Key Findings
- The PR removes a single line
_uiSearchBar.ShowsCancelButton = falsefromSearchHandlerAppearanceTracker.cson iOS, which prevented the native cancel button from appearing after focusing the Shell search, leaving the flyout icon and title hidden. - A new
EnterTextInShellSearchHandlerextension method was added toHelperExtensions.cs. - 🚨 CRITICAL REGRESSION:
GetDisplayDensity()extension method (and its helpersGetAndroidDisplayDensity,GetIOSDisplayDensity) was REMOVED fromHelperExtensions.csas a side-effect of addingEnterTextInShellSearchHandler. This breaksIssue28986_SafeAreaBorderOrientation.cswhich callsApp.GetDisplayDensity()on line 21 — this will cause a build error in the test project. - The new UITest
Issue22060.cscarries two[Category]attributes (ShellandSearchBar), violating the repo convention of exactly one category per test. - The test method contains an inline
#if IOSdirective to tap "Cancel" on iOS, violating the repo convention that platform-specific logic should be hidden behind extension methods. - The HostApp page
Issue22060ShellextendsShelldirectly rather than theTestShellhelper base class. - Prior agent review (MauiBot, commit
81d2fe8) gave a comprehensive analysis with the same code-quality concerns.
Edge Cases / Review Notes
- The single-line removal is the minimal correct fix; native
automaticallyShowsCancelButtononUISearchBarhandles cancel visibility automatically. - The
GetDisplayDensitydeletion appears unintentional — likely a copy/paste error where the author replaced the method block instead of inserting alongside it.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #28474 | Remove forced ShowsCancelButton = false in SearchHandlerAppearanceTracker; add UITest |
⏳ PENDING (Gate) | SearchHandlerAppearanceTracker.cs, HelperExtensions.cs, Issue22060.cs (×2) |
Original PR — has test convention issues + GetDisplayDensity deletion |
🚦 Gate — Test Verification
Gate Result PASSED:
Platform: ios
Mode: Full Verification
- Tests FAIL without fix:
- Tests PASS with fix:
Notes
- Verification was run via an isolated task agent using the
verify-tests-fail-without-fixskill on iOS withTestFilter: Issue22060. - The task agent reported successful two-way verification: the new test failed without the PR fix and passed with the PR fix.
- The task agent also made local verification edits in
Issue22060.cs(removing a duplicate[Category]) and in unrelatedIssue28986_SafeAreaBorderOrientation.csto work around a test compilation blocker. Those edits were not part of the PR under review and are not relied on as part of the functional iOS fix assessment. - The shared UI test still contains inline
#if IOSplatform logic, which is contrary to repository UI test guidance, but it did not prevent the gate from validating the regression.
Gate Result: ❌ FAILED
Platform: ios
Tests Detected
| # | Type | Test Name | Filter |
|---|---|---|---|
| 1 | UITest | Issue22060 | Issue22060 |
Verification
| Step | Expected | Actual | Result |
|---|---|---|---|
| Tests WITHOUT fix | FAIL | FAIL | ✅ |
| Tests WITH fix | PASS | FAIL | ❌ |
Fix Files Reverted
src/Controls/src/Core/Compatibility/Handlers/Shell/iOS/SearchHandlerAppearanceTracker.cs
Root Cause of Gate Failure
The "with fix" run failed due to build errors in the test project, not a test runtime failure. The app built successfully, but the iOS test project (Controls.TestCases.iOS.Tests.csproj) failed to compile:
-
error CS1061—Issue28986_SafeAreaBorderOrientation.cs:21callsApp.GetDisplayDensity(), which was accidentally deleted fromHelperExtensions.csas a side-effect of addingEnterTextInShellSearchHandler. -
error MAUI0002—Issue22060.cs:18has two[Category]attributes (Shell+SearchBar), violating the repo's MAUI analyzer rule requiring exactly one category per test.
Important: The iOS fix itself (removing ShowsCancelButton = false) is functionally correct — the test correctly FAILED without the fix, proving the test detects the bug. The gate failure is caused by introduced regressions in the PR's test/helper code, not the iOS runtime fix.
🔧 Fix — Analysis & Comparison
Gate Result PASSED:
Platform: ios
Mode: Full Verification
- Tests FAIL without fix:
- Tests PASS with fix:
Notes
- Verification was run via an isolated task agent using the
verify-tests-fail-without-fixskill on iOS withTestFilter: Issue22060. - The task agent reported successful two-way verification: the new test failed without the PR fix and passed with the PR fix.
- The task agent also made local verification edits in
Issue22060.cs(removing a duplicate[Category]) and in unrelatedIssue28986_SafeAreaBorderOrientation.csto work around a test compilation blocker. Those edits were not part of the PR under review and are not relied on as part of the functional iOS fix assessment. - The shared UI test still contains inline
#if IOSplatform logic, which is contrary to repository UI test guidance, but it did not prevent the gate from validating the regression.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #28474 | Remove forced ShowsCancelButton = false |
❌ GATE FAILED (build errors) | 4 code files + snapshots | Missing GetDisplayDensity + duplicate [Category] block build |
Attempts
| # | Model | Approach | Result | Notes |
|---|---|---|---|---|
| — | — | — | ⏳ In progress | — |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| — | — | — | — |
Exhausted: No
Selected Fix: ⏳ PENDING
📋 Report — Final Recommendation
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #28474 | Remove the forced behavior so iOS can show Cancel and restore Shell chrome; add issue page and screenshot UITest coverage. | PASSED (Gate) | 4 code files + snapshots | Simplest validated fix and matches native iOS behavior. |
| 1 | try-fix () | Dynamically toggle only during editing instead of suppressing it at initialization. | PASS | 1 file | Works, but is more complex than the PR for no clear gain. |
| 2 | try-fix () | Use hooks in to show Cancel on present and force nav restoration on dismiss. | PASS | 3 files | Worked, but is significantly more invasive and more fragile. |
| 3 | try-fix (gpt-5.3-codex) |
Explicitly refresh Shell nav chrome after search-bar editing FAIL | 1 file | Could not be behaviorally validated because the run hit shared compile/test-state issues first. | stops. |
| 4 | try-fix (gemini-3-pro-preview) |
Disable nav-bar hiding/obscuring during search and force nav refresh after search FAIL | 1 file | Changed UX/visual behavior and failed screenshot expectations. | ends. |
| 5 | try-fix (cross-pollinated) | Adjust search-controller presentation-context ownership and deactivate it explicitly on BLOCKED | 1-2 files | Hit pre-existing MAUI0002 test-state blocker before runtime validation. | teardown. |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| claude-opus-4.6 | 2 | Yes | Presentation-context ownership plus natural SetActive(false) dismissal. |
| claude-sonnet-4.6 | 2 | No | PR fix already minimal and idiomatic. |
| gpt-5.3-codex | 2 | Yes | Always define presentation context for the search controller. |
| gemini-3-pro-preview | 2 | No | Existing attempts already cover viable architecture. |
| claude-opus-4.6 | 3 | No | No better idea than the validated PR fix. |
| claude-sonnet-4.6 | 3 | No | Remaining ideas are higher-risk variants. |
| gpt-5.3-codex | 3 | No | Remaining levers overlap prior attempts or add risk. |
| gemini-3-pro-preview | 3 | No | Design space is exhausted; PR fix removes the root cause. |
Exhausted: Yes
Selected Fix: PR # It is the simplest passing fix, aligns with native iOS UISearchController behavior, and is less invasive than the passing alternatives.28474
This PR addresses the build failures in the inflight/current branch by: - Removing one UITestCategory from ShouldAppearFlyoutIconAndContentPageTitle test; previously, two UITestCategories were added. - Added the GetDisplayDensity, GetAndroidDisplayDensity, and GetIOSDisplayDensity methods again, which were removed in this PR: #28474 ### Test Case: - ShouldAppearFlyoutIconAndContentPageTitle - Issue28986_SafeAreaBorderOrientation
…n the shell search handler (#28474) ### Issue Details * When the search controller has an empty item source and is focused on the Shell search handler, the flyout icon and content page title disappear with no option to make them visible again. ### Root Cause * The ShowsCancelButton property of the Shell's UISearchController search bar is set to false. As a result, when the search controller is focused, the cancel button does not appear, preventing the flyout icon and content page title from being visible when the search controller has an empty item source. ### Description of Changes * Setting ShowsCancelButton to false is no longer necessary, as this behavior is now handled by the automaticallyShowsCancelButton property in UISearchBar. * The cancel button ensures that the flyout icon and content page title return to their normal visibility after focusing and unfocusing. When clicking the cancel button, the flyout icon and content page title are now correctly displayed, when the search controller has an empty item source. ### Issues Fixed Fixes #22060 Validated the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Output |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/6df06656-bc5e-4627-b940-f6b6ca91e994" >| <video src="https://github.com/user-attachments/assets/c3120cd8-b258-4858-af09-13ea65574f62">|
This PR addresses the build failures in the inflight/current branch by: - Removing one UITestCategory from ShouldAppearFlyoutIconAndContentPageTitle test; previously, two UITestCategories were added. - Added the GetDisplayDensity, GetAndroidDisplayDensity, and GetIOSDisplayDensity methods again, which were removed in this PR: #28474 ### Test Case: - ShouldAppearFlyoutIconAndContentPageTitle - Issue28986_SafeAreaBorderOrientation
…n the shell search handler (dotnet#28474) ### Issue Details * When the search controller has an empty item source and is focused on the Shell search handler, the flyout icon and content page title disappear with no option to make them visible again. ### Root Cause * The ShowsCancelButton property of the Shell's UISearchController search bar is set to false. As a result, when the search controller is focused, the cancel button does not appear, preventing the flyout icon and content page title from being visible when the search controller has an empty item source. ### Description of Changes * Setting ShowsCancelButton to false is no longer necessary, as this behavior is now handled by the automaticallyShowsCancelButton property in UISearchBar. * The cancel button ensures that the flyout icon and content page title return to their normal visibility after focusing and unfocusing. When clicking the cancel button, the flyout icon and content page title are now correctly displayed, when the search controller has an empty item source. ### Issues Fixed Fixes dotnet#22060 Validated the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Output |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/6df06656-bc5e-4627-b940-f6b6ca91e994" >| <video src="https://github.com/user-attachments/assets/c3120cd8-b258-4858-af09-13ea65574f62">|
…n the shell search handler (#28474) ### Issue Details * When the search controller has an empty item source and is focused on the Shell search handler, the flyout icon and content page title disappear with no option to make them visible again. ### Root Cause * The ShowsCancelButton property of the Shell's UISearchController search bar is set to false. As a result, when the search controller is focused, the cancel button does not appear, preventing the flyout icon and content page title from being visible when the search controller has an empty item source. ### Description of Changes * Setting ShowsCancelButton to false is no longer necessary, as this behavior is now handled by the automaticallyShowsCancelButton property in UISearchBar. * The cancel button ensures that the flyout icon and content page title return to their normal visibility after focusing and unfocusing. When clicking the cancel button, the flyout icon and content page title are now correctly displayed, when the search controller has an empty item source. ### Issues Fixed Fixes #22060 Validated the behaviour in the following platforms - [x] Android - [x] Windows - [x] iOS - [x] Mac ### Output |Before|After| |--|--| | <video src="https://github.com/user-attachments/assets/6df06656-bc5e-4627-b940-f6b6ca91e994" >| <video src="https://github.com/user-attachments/assets/c3120cd8-b258-4858-af09-13ea65574f62">|
This PR addresses the build failures in the inflight/current branch by: - Removing one UITestCategory from ShouldAppearFlyoutIconAndContentPageTitle test; previously, two UITestCategories were added. - Added the GetDisplayDensity, GetAndroidDisplayDensity, and GetIOSDisplayDensity methods again, which were removed in this PR: #28474 ### Test Case: - ShouldAppearFlyoutIconAndContentPageTitle - Issue28986_SafeAreaBorderOrientation
Issue Details
Root Cause
Description of Changes
Issues Fixed
Fixes #22060
Validated the behaviour in the following platforms
Output
Issue_22060_Before.mp4
Issue_22060_After.mp4