dotnet / dotnet/winforms

WebBrowser control blocks accelerators of buttons on form

Open
#8,862 4 comments 0 reactions 1 assignee Claimed by @JeremyKuhne View on GitHub
:boom: regression-release :construction: work in progress area-COM priority-2 tenet-compatibility
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

### .NET version

.NET 6.0, .NET 7.0

### Did it work in .NET Framework?

Yes

### Did it work in any of the earlier releases of .NET Core or .NET 5+?

.NET 4.8

### Issue description

See attached sample: I have a "System.Windows.Forms.WebBrowser" control on a UserControl.
The UserControl and the root form contain buttons with accelerator keys. In .NET6, the accelerators for the buttons don't work reliable.

### Steps to reproduce

Focus the textbox on the UserControl, then press "Alt" and one of the accelerator keys "B" or "O".

- The button on the user control will be clicked when pressing the accelerator the second time. On first button press, nothing happens.
- The "OK" button on the root form is never called.

The sample also has target framework 4.8 to demonstrate that this it worked there.

[WebBrowserTest.zip](https://github.com/dotnet/winforms/files/10990996/WebBrowserTest.zip)

The event "WebBrowserControl.PreviewKeyDown" is called twice for each button. This means I cannot handle a "Alt + accelerator" press myself (and search for a button with this accelerator).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.