forked from dotnet/maui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Shell Flyout Menu Visibility Issue When Navigating Between TabBar…
… and Flyout Items (dotnet#25510) * 25436 - Flyout menu should be visible after navigating from a menu item * Alternative fix committed * Added the testcases and its images * Committed the windows image and changed the tap coordinates to Xpath for Android --------- Co-authored-by: Karthik Raja <92788387+karthikraja-arumugam@users.noreply.github.com> Co-authored-by: AhamedAliNishad <ahamedalinishad.j@syncfusion.com> Co-authored-by: Rui Marinho <me@ruimarinho.net>
- Loading branch information
1 parent
d91bf0a
commit 0893ce0
Showing
9 changed files
with
159 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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 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
Binary file added
BIN
+41.5 KB
...sts/snapshots/android/FlyoutMenuShouldNotDisappearWhenNavigateUsingServices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions
19
src/Controls/tests/TestCases.HostApp/Issues/Issue25436.xaml
This file contains 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,19 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<local:TestShell xmlns="http://schemas.microsoft.com/dotnet/2021/maui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | ||
xmlns:local="using:Maui.Controls.Sample.Issues" | ||
xmlns:issues="clr-namespace:Maui.Controls.Sample.Issues" | ||
x:Class="Maui.Controls.Sample.Issues.Issue25436"> | ||
|
||
<FlyoutItem Title="Home" > | ||
<ShellContent | ||
ContentTemplate="{DataTemplate issues:Issue25436Firstpage}" | ||
Route="home" /> | ||
</FlyoutItem> | ||
<TabBar> | ||
<ShellContent | ||
ContentTemplate="{DataTemplate issues:Issue25436LoginPage}" | ||
Route="login" /> | ||
</TabBar> | ||
|
||
</local:TestShell> |
98 changes: 98 additions & 0 deletions
98
src/Controls/tests/TestCases.HostApp/Issues/Issue25436.xaml.cs
This file contains 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,98 @@ | ||
using Maui.Controls.Sample.Issues; | ||
|
||
namespace Maui.Controls.Sample.Issues | ||
{ | ||
[Issue(IssueTracker.Github, 25436, "[.NET 9] Shell Flyout menu not rendering after navigating from a MenuItem page", PlatformAffected.All)] | ||
public partial class Issue25436 : TestShell | ||
{ | ||
public Issue25436() | ||
{ | ||
InitializeComponent(); | ||
} | ||
protected override void Init() | ||
{ | ||
|
||
} | ||
|
||
} | ||
public class Issue25436Firstpage : ContentPage | ||
{ | ||
public Issue25436Firstpage() | ||
{ | ||
var button = new Button | ||
{ | ||
Text = "Click here to navigate back", | ||
VerticalOptions = LayoutOptions.Center, | ||
HorizontalOptions = LayoutOptions.Center | ||
}; | ||
button.Clicked += async (s, e) => await Shell.Current.GoToAsync("//login"); | ||
Content = button; | ||
button.AutomationId = "BackButton"; | ||
Title = "_25436 first flyout"; | ||
} | ||
} | ||
|
||
public class Issue25436LoginPage : ContentPage | ||
{ | ||
Issue25436INavigationService _navigationService; | ||
public Issue25436LoginPage(Issue25436INavigationService navigationService) | ||
{ | ||
_navigationService = navigationService; | ||
var loginButton = new Button | ||
{ | ||
Text = "Login" | ||
}; | ||
loginButton.AutomationId = "Login"; | ||
loginButton.Clicked += OnLoginButtonClicked; | ||
|
||
Content = new StackLayout | ||
{ | ||
Children = | ||
{ | ||
new Label { Text = "This is the login page" }, | ||
loginButton | ||
} | ||
}; | ||
Title = "_25436 login page"; | ||
} | ||
private async void OnLoginButtonClicked(object sender, EventArgs e) | ||
{ | ||
await _navigationService.GoToAsync("//home"); | ||
} | ||
} | ||
|
||
static class Issue25436Extensions | ||
{ | ||
public static MauiAppBuilder Issue25436RegisterNavigationService(this MauiAppBuilder builder) | ||
{ | ||
// Register services | ||
builder.Services.AddSingleton<Issue25436INavigationService, Issue25436NavigationService>(); | ||
|
||
// Register pages | ||
builder.Services.AddTransient<Issue25436LoginPage>(); | ||
builder.Services.AddSingleton<Issue25436Firstpage>(); | ||
|
||
return builder; | ||
} | ||
} | ||
|
||
public interface Issue25436INavigationService | ||
{ | ||
Task GoToAsync(string route); | ||
} | ||
|
||
public partial class Issue25436NavigationService : Issue25436INavigationService | ||
{ | ||
public Task GoToAsync(string route) | ||
{ | ||
if (Shell.Current is null) | ||
{ | ||
throw new NotSupportedException($"Navigation with the '{nameof(GoToAsync)}' method is currently supported only with a Shell-enabled application."); | ||
} | ||
|
||
return Shell.Current.GoToAsync(route); | ||
} | ||
} | ||
|
||
} | ||
|
This file contains 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
32 changes: 32 additions & 0 deletions
32
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25436.cs
This file contains 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,32 @@ | ||
#if !MACCATALYST | ||
using NUnit.Framework; | ||
using UITest.Appium; | ||
using UITest.Core; | ||
|
||
namespace Microsoft.Maui.TestCases.Tests.Issues | ||
{ | ||
internal class Issue25436 : _IssuesUITest | ||
{ | ||
public override string Issue => "[.NET 9] Shell Flyout menu not rendering after navigating from a MenuItem page"; | ||
|
||
public Issue25436(TestDevice testDevice) : base(testDevice) { } | ||
|
||
[Test] | ||
[Category(UITestCategories.Shell)] | ||
public void FlyoutMenuShouldNotDisappearWhenNavigateUsingServices() | ||
{ | ||
App.WaitForElement("BackButton"); | ||
App.Tap("BackButton"); | ||
App.WaitForElement("Login"); | ||
App.Tap("Login"); | ||
#if ANDROID | ||
App.Tap(AppiumQuery.ByXPath("//android.widget.ImageButton[@content-desc='Open navigation drawer']")); | ||
#else | ||
App.Tap(FlyoutIconAutomationId); | ||
#endif | ||
VerifyScreenshot(); | ||
} | ||
|
||
} | ||
} | ||
#endif |
Binary file added
BIN
+7.36 KB
...sts/snapshots/windows/FlyoutMenuShouldNotDisappearWhenNavigateUsingServices.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
+8.75 KB
...S.Tests/snapshots/ios/FlyoutMenuShouldNotDisappearWhenNavigateUsingServices.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.