Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ protected override void OnAttachedToWindow()
protected override void OnDetachedFromWindow()
{
base.OnDetachedFromWindow();

_isAttached = false;
_adapter.CloseContextActions();
_adapter.IsAttachedToWindow = _isAttached;
}

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#if ANDROID
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue19831 : _IssuesUITest
{
public override string Issue => "[Android] Action mode menu doesn't disappear when switch on another tab";

public Issue19831(TestDevice device)
: base(device)
{ }

[Test]
public void ActionModeMenuShouldNotBeVisibleAfterSwitchingTab()
{
_ = App.WaitForElement("Item1");

// 1. Open a context menu.
App.LongPress("Item1");

// 2. Navigate to a different tab.
App.Click("button");

// 3. The test passes if the action mode menu is not visible.
VerifyScreenshot();
}
}
#endif
37 changes: 37 additions & 0 deletions src/Controls/tests/TestCases/Issues/Issue19831.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8" ?>
<Shell xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Maui.Controls.Sample.Issues.Issue19831">

<Tab>
<ShellContent Title="Page 1">
<ContentPage AutomationId="page">
<StackLayout>
<ListView>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<ViewCell.ContextActions>
<MenuItem Text="View"/>
</ViewCell.ContextActions>
<Label Text="{Binding .}" AutomationId="{Binding .}"/>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
<ListView.ItemsSource>
<x:Array Type="{x:Type x:String}">
<x:String>Item1</x:String>
<x:String>Item2</x:String>
</x:Array>
</ListView.ItemsSource>
</ListView>
<Button AutomationId="button" Text="Go to page2" Clicked="Button_Clicked"/>
</StackLayout>
</ContentPage>
</ShellContent>

<ShellContent Title="Page 2" Route="Page2">
<ContentPage/>
</ShellContent>
</Tab>
</Shell>
20 changes: 20 additions & 0 deletions src/Controls/tests/TestCases/Issues/Issue19831.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Xaml;

namespace Maui.Controls.Sample.Issues;

[XamlCompilation(XamlCompilationOptions.Compile)]
[Issue(IssueTracker.Github, 19831, "[Android] Action mode menu doesn't disappear when switch on another tab", PlatformAffected.Android)]

public partial class Issue19831 : Shell
{
public Issue19831()
{
InitializeComponent();
}

void Button_Clicked(System.Object sender, System.EventArgs e)
{
GoToAsync("//Page2");
}
}