Skip to content

Commit

Permalink
fix(popup): add a workaround to make popup focusable despite being no…
Browse files Browse the repository at this point in the history
…t IsTabStop
  • Loading branch information
ramezgerges committed Feb 5, 2024
1 parent 4d00c81 commit ed3d300
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ public async Task TouchTest()
var injector = InputInjector.TryCreate() ?? throw new InvalidOperationException("Failed to init the InputInjector");
using var finger = injector.GetFinger();

Log.Comment("Check simulate touch mode checkbox"); // Uno Doc: this is not needed, we use an injected touch pointer
// Uno Doc: this is not needed, we use an injected touch pointer
Log.Comment("Check simulate touch mode checkbox");
// simulateTouchCheckBox.Click(); // This conveniently moves the mouse over the checkbox so that it isn't over the split button yet
simulateTouchCheckBox.ProgrammaticClick();
await WindowHelper.WaitForIdle();
Expand Down Expand Up @@ -243,7 +244,7 @@ public async Task KeyboardTest()

Verify.AreEqual("0", flyoutOpenedCountTextBlock.Text);
Log.Comment("Verify that pressing alt-down on SplitButton opens the flyout");
KeyboardHelper.PressKeySequence("$d$_alt#$d$_down#$u$_down#alt");
KeyboardHelper.PressKeySequence("$d$_alt#$d$_down#$u$_down#$u$_alt");
await WindowHelper.WaitForIdle();
Verify.AreEqual("1", flyoutOpenedCountTextBlock.Text);

Expand Down
3 changes: 3 additions & 0 deletions src/Uno.UI/UI/Xaml/Controls/Popup/Popup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,4 +311,7 @@ internal Brush LightDismissOverlayBackground

internal static DependencyProperty LightDismissOverlayBackgroundProperty { get; } =
DependencyProperty.Register(nameof(LightDismissOverlayBackground), typeof(Brush), typeof(Popup), new FrameworkPropertyMetadata(defaultValue: null, propertyChangedCallback: (o, e) => ((Popup)o).ApplyLightDismissOverlayMode()));

// On WinUi, a popup is not IsTabStop but is somehow focusable. This is a workaround to match that behaviour.
internal override bool IsFocusableForFocusEngagement() => true;
}

0 comments on commit ed3d300

Please sign in to comment.