-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix iOS SearchHandler suggestions list gap on iPhone #32931
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2a738e3
b6a5980
6555b51
20c776f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <Shell xmlns:controls="clr-namespace:Maui.Controls.Sample.Issues" | ||
| xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
| xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
| x:Class="Maui.Controls.Sample.Issues.Issue32930"> | ||
| <ShellContent | ||
| Title="Home" | ||
| Route="MainPage"> | ||
| <ContentPage> | ||
| <Shell.SearchHandler> | ||
| <controls:Issue32930SearchHandler | ||
| x:Name="searchHandler" | ||
| AutomationId="SearchHandler" | ||
| Placeholder="Type to search..." | ||
| Keyboard="Plain" | ||
| ShowsResults="True" /> | ||
| </Shell.SearchHandler> | ||
| <StackLayout Padding="20"> | ||
| <Label | ||
| AutomationId="Instructions" | ||
| Text="Tap the search bar. On iPhone, the suggestions list should follow the search bar upward with no gap." /> | ||
| </StackLayout> | ||
| </ContentPage> | ||
| </ShellContent> | ||
| </Shell> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 32930, "[iOS] SearchHandler suggestions list does not follow the search bar upward movement on iPhone, creating a layout gap", PlatformAffected.iOS)] | ||
| public partial class Issue32930 : Shell | ||
| { | ||
| public Issue32930() | ||
| { | ||
| InitializeComponent(); | ||
| } | ||
| } | ||
|
|
||
| public class Issue32930SearchHandler : SearchHandler | ||
| { | ||
| static readonly List<string> _allItems = new() | ||
| { | ||
| "Apple", | ||
| "Banana", | ||
| "Cherry", | ||
| "Date", | ||
| "Elderberry", | ||
| "Fig", | ||
| "Grape" | ||
| }; | ||
|
|
||
| public Issue32930SearchHandler() | ||
| { | ||
| ItemsSource = _allItems; | ||
| } | ||
|
|
||
| protected override void OnQueryChanged(string oldValue, string newValue) | ||
| { | ||
| base.OnQueryChanged(oldValue, newValue); | ||
|
|
||
| if (string.IsNullOrEmpty(newValue)) | ||
| { | ||
| ItemsSource = _allItems; | ||
| } | ||
| else | ||
| { | ||
| ItemsSource = _allItems.Where(s => s.Contains(newValue, StringComparison.OrdinalIgnoreCase)).ToList(); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #if IOS | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [major] Test coverage / CI discovery - Wrapping the whole test file in |
||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue32930 : _IssuesUITest | ||
| { | ||
| public Issue32930(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "[iOS] SearchHandler suggestions list does not follow the search bar upward movement on iPhone, creating a layout gap"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Shell)] | ||
| public void SearchHandlerSuggestionsListFollowsSearchBar() | ||
| { | ||
| // Wait for the page to load | ||
| App.WaitForElement("Instructions"); | ||
|
|
||
| // Enter text in the search handler to trigger suggestions display | ||
| App.EnterText(AppiumQuery.ByXPath("//XCUIElementTypeSearchField"), "A"); | ||
|
|
||
| // Wait for suggestions to appear | ||
| App.WaitForElement("Apple"); | ||
|
|
||
| // Verify the suggestions list appears correctly | ||
| // If the fix works, the suggestions list should be visible and positioned directly under the search bar | ||
| // We use screenshot verification to ensure there is no visible gap between the search bar and suggestions | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
| #endif | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good