MicrosoftEdge / MicrosoftEdge/WebView2Feedback

[Problem/Bug]: Issue with WebView2CompositionControl .NETFramework4.8

Open
#5,098 6 comments 0 reactions 1 assignee View on GitHub

@venky8951 is already working on this.

Since Feb 14, 2025.

bug
Dominant language
PowerShell
Stars
526
Forks
67
PR merge metrics
No merged PRs in 30d

Description

What happened?

WebView2CompositionControl component can't be focused, when it is nested under "ScrollViewer". Like this:

<ScrollViewer> <wv2:WebView2CompositionControl /> </ScrollViewer>

Focus of webview control is immediately cancelled and "Focus Lost" event is raised, after click at element within navigated web url (e.g TextBox).
If ScrollViewwer id set with property Focusable="False" like it is below, it is possible select textbox and type into it. But is is not possble to use navigation narrows or other navigation keys (Home, End, PageUp/Dn)
<ScrollViewer Focusable="False"> <wv2:WebView2CompositionControl /> </ScrollViewer>

I do develop an plugin dll into .NET Framework application and don't have an possibility to change/remove the <ScrollViewer>. Because it is part of View, where I need to inject my webview2 component.

Importance

Important. My app's user experience is significantly compromised.

Runtime Channel

Stable release (WebView2 Runtime)

Runtime Version

132.0.2957.140

SDK Version

1.0.3065.39

Framework

WPF

Operating System

Windows 11

OS Version

22631.4751

Repro steps

It is reproducible by creating simple project with 2 webview components and do navigate. Upper webview is nested to scrollviewer and the lower one is not.
Clicking on text box in upper webview, and using narrow keys, you will se how focus lost event is fired from webview element. Attached is project I do use for testing. It is copy of situation I do face in production application.
My custom view is injected into main view and main view is nesting region in ScrollViewer. Because of that, I can't change Scrollviewer settings.
Like This:

MainWindow.yaml:
<ScrollViewer> <local:WebViewControlComponent Focusable="True"></local:WebViewControlComponent> </ScrollViewer>
WebViewControlComponent.yaml:
<UserControl> <Grid> <wv2:WebView2CompositionControl Visibility="Visible" MinHeight="100" /> </Grid> </UserControl>

Any help is highly appreciated, I have been waiting for release of this WebView2CompositionControl a while due to not working navigation keys in Webview2 and PanelZ index.

WpfTestdotNetFW.zip

Repros in Edge Browser

No, issue does not reproduce in the corresponding Edge version

Regression

No, this never worked

Last working version (if regression)

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.