Browse Source

Don't steal focus when hovering menu bar.

Don't focus the menu item when simply hovering over a top-level menu item. The item should only be focused when the containing menu is open.

Fixes #7906
pull/7953/head
Steven Kirk 4 years ago
parent
commit
5f51c99c13
  1. 4
      src/Avalonia.Controls/MenuItem.cs

4
src/Avalonia.Controls/MenuItem.cs

@ -644,7 +644,9 @@ namespace Avalonia.Controls
/// <param name="e">The property change event.</param>
private void IsSelectedChanged(AvaloniaPropertyChangedEventArgs e)
{
if ((bool)e.NewValue!)
var parentMenu = Parent as Menu;
if ((bool)e.NewValue! && (parentMenu is null || parentMenu.IsOpen))
{
Focus();
}

Loading…
Cancel
Save