AvaloniaUI/Avalonia

Accelerator Underlines get stuck on after first key UNLESS a menu item has been shown once for the application.

tomlm opened this issue · 0 comments

tomlm commented

Describe the bug

If you have AccessKeys defined on labels/buttons etc they don't display correctly unless the application has shown a menu at least once.

To Reproduce

  1. create a new avalonia app
  2. Change the mainwindow to look like this:
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Class="AvaloniaApplication2.MainWindow" >
  <StackPanel Orientation="Vertical">
<!--   <Menu/> -->
    <Label Target="firstNameEdit">_First name</Label>
    <TextBox Name="firstNameEdit"></TextBox>
  </StackPanel>
</Window>
  1. Run the app, hit the Alt key multiple times. The first ALT key will show underlines, but after that it will be stuck on.
  2. Uncomment the MENU in the xaml
  3. Try again, Alt keys will toggle the underline on/off.

It doesn't matter when or where the menu is displayed (it does not have to be part of the visual tree). The accelerator key visualization only works after a menu has been displayed at least once for the application.

Expected behavior

The menu should not be needed to for accelerator key visualization to work correctly.

Avalonia version

11.2.1

OS

Windows

Additional context

No response