microsoft / microsoft-ui-xaml

Windows UI Library: the latest Windows 10 native controls and Fluent styles for your applications
MIT License
6.27k stars 674 forks source link

Keyboard Accelerator with Menu (Alt) Modifier plays an alert sound (WinUI Desktop) #4379

Open bridgesquared opened 3 years ago

bridgesquared commented 3 years ago

Describe the bug If you add a keyboard accelerator to a control (typically button, appbarbutton etc.) that uses the Menu modifier (the Alt button), when the accelerator is invoked, the required action is processed but we get a spurious windows alert sound played at the same time. This is somewhat disconcerting for users as it makes them think they did something wrong and to be honest it's really annoying ;-) if you make a lot of use of Alt+ key combinations for desktop/keyboard interaction.

Steps to reproduce the bug

Steps to reproduce the behavior:

  1. Create a new "Blank App, Packagde (WinUI in Desktop)" app
  2. Modify the Main Window xaml to include a keyboard accelerator:
        <Button x:Name="myButton"
                Click="myButton_Click">
            <Button.KeyboardAccelerators>
                <KeyboardAccelerator Key="C"
                                     Modifiers="Menu" />
            </Button.KeyboardAccelerators>
            Click Me
        </Button>
  3. Run the app
  4. Activate the keyboard accelerator (Alt+C)
  5. The button will change text but there will be a windows sound played at the same time

Expected behavior Because there is a valid accelerator I expect there to be no sound unless we add code to play it.

I would be happy with the sound being played if there wasn't an appropriate accelerator.

Screenshots Can add video if necessary, in case it's only my box?

Version Info

NuGet package version:

  <ItemGroup>
    <PackageReference Include="Microsoft.WinUI" Version="3.0.0-preview4.210210.4" />
    <Manifest Include="$(ApplicationManifest)" />
  </ItemGroup>

This was around in Preview 3 so it's not a regression.

Windows app type: UWP Win32
Yes
Windows 10 version Saw the problem?
Insider Build (xxxxx)
October 2020 Update (19042) Yes
May 2020 Update (19041)
November 2019 Update (18363)
May 2019 Update (18362)
October 2018 Update (17763)
April 2018 Update (17134)
Fall Creators Update (16299)
Creators Update (15063)
Device form factor Saw the problem?
Desktop Yes
Xbox
Surface Hub
IoT

Additional context

StephenLPeters commented 3 years ago

@Austin-Lamb FYI

StephenLPeters commented 3 years ago

I could not reproduce this issue in Winui2

bridgesquared commented 3 years ago

I could not reproduce this issue in Winui2

@StephenLPeters I believe this is likely to be a Desktop only issue, as I don't recall having the problem in UWP apps even though I used the same style?

wbokkers commented 2 years ago

This is stil an issue in Windows App SDK 1.1.4 (WinUI 3).

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

jeffdav commented 3 months ago

This issue is still occurring.