-
Notifications
You must be signed in to change notification settings - Fork 2k
[Android] Fix SearchBar IME full-screen extract mode in landscape orientation #35197
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cd4522b
[Android] Fix SearchBar presentation in horizontal screen orientation
SubhikshaSf4851 5db54b7
Updated suggestion
SubhikshaSf4851 0afc83b
committed the suggestion
SubhikshaSf4851 3bd0cad
updated suggestion
SubhikshaSf4851 9ef8f7e
updated suggestion
SubhikshaSf4851 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+123 KB
...Tests/snapshots/android/SearchBarLandscapeShowsInlineKeyboardNotExtractMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| using Microsoft.Maui.Controls; | ||
|
|
||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 14708, "Android SearchBar in landscape shows full-screen IME extract mode", PlatformAffected.Android)] | ||
| public class Issue14708 : ContentPage | ||
| { | ||
| Label _searchTextLabel; | ||
| SearchBar _primarySearchBar; | ||
|
|
||
| public Issue14708() | ||
| { | ||
| _searchTextLabel = new Label | ||
| { | ||
| Text = "Search text: (none)", | ||
| AutomationId = "SearchTextLabel", | ||
| FontSize = 13 | ||
| }; | ||
|
|
||
| _primarySearchBar = new SearchBar | ||
| { | ||
| Text = "Hello, landscape!", | ||
| Placeholder = "Tap here in landscape — keyboard should be inline", | ||
| AutomationId = "SearchBarControl" | ||
| }; | ||
|
|
||
| var searchBar2 = new SearchBar | ||
| { | ||
| Placeholder = "Second SearchBar", | ||
| AutomationId = "SearchBar2" | ||
| }; | ||
|
|
||
|
|
||
| var searchBar3 = new SearchBar | ||
| { | ||
| Text = "Hello, landscape!", | ||
| Placeholder = "Third SearchBar", | ||
| AutomationId = "SearchBar3" | ||
| }; | ||
|
|
||
|
|
||
| Content = new ScrollView | ||
| { | ||
| VerticalOptions = LayoutOptions.Fill, | ||
| Content = new VerticalStackLayout | ||
| { | ||
| Padding = new Thickness(16), | ||
| Spacing = 12, | ||
| Children = | ||
| { | ||
| new Label | ||
| { | ||
| Text = "Rotate to LANDSCAPE, then tap any SearchBar. " + | ||
| "The keyboard should appear inline at the bottom — " + | ||
| "NOT as a full-screen black overlay.", | ||
| HorizontalTextAlignment = TextAlignment.Center | ||
| }, | ||
| _primarySearchBar, | ||
| _searchTextLabel, | ||
| new BoxView { HeightRequest = 1, Color = Colors.LightGray }, | ||
| new Label { Text = "Additional SearchBars:", FontAttributes = FontAttributes.Italic, FontSize = 13 }, | ||
| searchBar2, | ||
| searchBar3 | ||
| } | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| } | ||
39 changes: 39 additions & 0 deletions
39
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue14708.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #if ANDROID || IOS // Orientation changes and IME behavior are only relevant on mobile platforms | ||
|
SubhikshaSf4851 marked this conversation as resolved.
|
||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue14708 : _IssuesUITest | ||
| { | ||
| public Issue14708(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Android SearchBar in landscape shows full-screen IME extract mode"; | ||
|
|
||
| [TearDown] | ||
| public void TearDown() | ||
| { | ||
| App.SetOrientationPortrait(); | ||
| } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.SearchBar)] | ||
| public void SearchBarLandscapeShowsInlineKeyboardNotExtractMode() | ||
| { | ||
| // Rotate to landscape — this is the trigger condition for the bug | ||
| App.SetOrientationLandscape(); | ||
|
|
||
| App.WaitForElement("SearchBarControl"); | ||
|
|
||
| // Tap the primary SearchBar to open the keyboard | ||
| App.Tap("SearchBarControl"); | ||
|
|
||
| // In the unfixed state, Android enters IME extract mode in landscape: | ||
| // a full-screen black overlay replaces the inline keyboard and covers all | ||
| // page content. VerifyScreenshot() catches this because the visual output | ||
| // is dramatically different from the fixed (inline-keyboard) baseline. | ||
|
SubhikshaSf4851 marked this conversation as resolved.
|
||
| VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)); | ||
|
SubhikshaSf4851 marked this conversation as resolved.
|
||
| } | ||
| } | ||
| #endif | ||
Binary file added
BIN
+144 KB
....Tests/snapshots/ios-26/SearchBarLandscapeShowsInlineKeyboardNotExtractMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+120 KB
...iOS.Tests/snapshots/ios/SearchBarLandscapeShowsInlineKeyboardNotExtractMode.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.