Skip to content

Commit 772593a

Browse files
authored
Merge pull request #19652 from unoplatform/mergify/bp/release/stable/5.6/pr-19625
fix: Make SplitButton click and tap behave the same (backport #19625)
2 parents 3d2d4f8 + 8523edb commit 772593a

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/Uno.UI.RuntimeTests/MUX/Microsoft_UI_Xaml_Controls/SplitButton/SplitButtonTests_InteractionTests.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,18 +154,20 @@ public async Task TouchTest()
154154
Verify.AreEqual("0", clickCountTextBlock.Text);
155155
Verify.AreEqual("0", flyoutOpenedCountTextBlock.Text);
156156

157-
Log.Comment("Click primary button to open flyout in touch mode");
157+
Log.Comment("Click primary button in touch mode");
158158
// ClickPrimaryButton(splitButton);
159159
await ClickPrimaryButton(splitButton, finger);
160160
await WindowHelper.WaitForIdle();
161161

162-
// Uno TODO: the test outputs 1 and 0 instead of 1 and 0
163-
// This works correctly when manually testing by hand, but fails in the runtime tests.
164-
// Verify.AreEqual("0", clickCountTextBlock.Text);
165-
// Verify.AreEqual("1", flyoutOpenedCountTextBlock.Text);
166162
Verify.AreEqual("1", clickCountTextBlock.Text);
167163
Verify.AreEqual("0", flyoutOpenedCountTextBlock.Text);
168164

165+
Log.Comment("Click secondary button in touch mode");
166+
await ClickSecondaryButton(splitButton, finger);
167+
168+
Verify.AreEqual("1", clickCountTextBlock.Text);
169+
Verify.AreEqual("1", flyoutOpenedCountTextBlock.Text);
170+
169171
Log.Comment("Close flyout by clicking over the button");
170172
// splitButton.Click();
171173
await ClickPrimaryButton(splitButton, finger);

src/Uno.UI/Microsoft/UI/Xaml/Controls/SplitButton/SplitButton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ private void OnVisualPropertyChanged(DependencyObject sender, DependencyProperty
209209
internal void UpdateVisualStates(bool useTransitions = true)
210210
{
211211
// place the secondary button
212-
if (m_lastPointerDeviceType == PointerDeviceType.Touch || m_isKeyDown)
212+
if (m_isKeyDown)
213213
{
214214
VisualStateManager.GoToState(this, "SecondaryButtonSpan", useTransitions);
215215
}

0 commit comments

Comments
 (0)