Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 1, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

On iPhone, when tapping a SearchHandler, the navigation bar hides and the search bar animates upward. The suggestions list was not following this movement, creating a visible gap. iPad and Android work correctly.

Root cause: When HidesNavigationBarDuringPresentation is true (the iOS default), the navigation bar hides during search presentation and the search bar animates upward, but the suggestions list doesn't follow properly on iPhone.

Fix: Set HidesNavigationBarDuringPresentation = false and ObscuresBackgroundDuringPresentation = false on the UISearchController when it's created in ShellPageRendererTracker.AttachSearchController(). This prevents the navigation bar from hiding during search presentation, keeping the suggestions list correctly attached to the search bar.

_searchController.HidesNavigationBarDuringPresentation = false;
_searchController.ObscuresBackgroundDuringPresentation = false;

This approach is based on a working workaround provided by @pictos in the issue comments.

Issues Fixed

Fixes #32930

Original prompt

This section details on the original issue you should resolve

<issue_title>[iOS] SearchHandler suggestions list does not follow the search bar upward movement on iPhone, creating a layout gap</issue_title>
<issue_description>### Description

I have encountered a UI layout issue when using SearchHandler within a Shell page on iOS (.NET 9/10).

Steps to Reproduce

Current Behavior:
When tapping the search box to focus:
The navigation bar title hides.
The search bar animates/floats upwards as expected.
However, the suggestions drop-down list does not follow the search bar's upward movement. It seems to remain anchored to its original position (before the search bar moved).
Result:
This creates a visible gap between the search bar and the suggestions list, revealing the underlying UI content in between.
Platform Specifics:
iPhone: Issue reproduces (Bug).
iPad: Works correctly (suggestions list stays attached to the search bar).
Android: Works correctly.
Environment
.NET MAUI Version: .NET 9 / .NET 10
Platform: iOS (iPhone only)

Link to public reproduction project repository

No response

Version with bug

10.0.10

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

No response

Affected platforms

iOS

Affected platform versions

iOS 15 -iOS 26.1

Did you find any workaround?

No response

Relevant log output

```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
<comment_new><author>@jfversluis</author><body>
Yeah I've seen this too unfortunately.</body></comment_new>
</comments>

Custom agent used: issue-resolver
Specialized agent for investigating and resolving community-reported .NET MAUI issues through hands-on testing and implementation


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix SearchHandler suggestions list alignment on iPhone Fix iOS SearchHandler suggestions list gap on iPhone Dec 1, 2025
Copilot AI requested a review from jfversluis December 1, 2025 10:03
Copilot finished work on behalf of jfversluis December 1, 2025 10:03
@jfversluis
Copy link
Member

/azp run MAUI-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

@copilot this fix is confirmed to not work. Can you have a look at the workaround in #32930 (comment) that does work. It looks a bit hacky though, is there a decent way to implement this directly in our codebase?

Copy link
Contributor Author

Copilot AI commented Dec 4, 2025

@copilot this fix is confirmed to not work. Can you have a look at the workaround in #32930 (comment) that does work. It looks a bit hacky though, is...

I've updated the fix based on the workaround from @pictos. The previous approach setting ExtendedLayoutIncludesOpaqueBars on the results view controller didn't work because the actual cause is the navigation bar hiding during search presentation.

The new fix in commit 20c776f sets HidesNavigationBarDuringPresentation = false and ObscuresBackgroundDuringPresentation = false directly on the UISearchController when it's created in ShellPageRendererTracker.AttachSearchController(). This is cleaner than the workaround approach because it sets these properties right after the search controller is created, rather than having to access it later via the navigation controller.

@jfversluis
Copy link
Member

/azp run MAUI-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copilot finished work on behalf of jfversluis December 4, 2025 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] SearchHandler suggestions list does not follow the search bar upward movement on iPhone, creating a layout gap

2 participants