MicrosoftEdge / MicrosoftEdge/WebView2Feedback

Windows 11 update - KB5030219 - Unable to enter issue on the WebView2 browser text box keyboard.

Open
#3,802 5 comments 0 reactions 1 assignee View on GitHub

@victorhuangwq is already working on this.

Since Jan 8, 2024.

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

Description

Description
On my computer system Windows11, after updating security patch KB5030219, I created a UWP application using Visual Studio Enterprise 2022. After using WebView2 component in the application to access the URL that requires x509 certificate authentication, The certificate window popped up and when I clicked Cancel, the text field in the HTML content layout couldn't accept any text input from the keyboard.

Version
SDK: Microsoft.UI.Xaml v2.8.2 & Microsoft.Web.WebView2 v1.0.2045.28 or Latest version.
Runtime: 117.0.2045.31
Framework: WinUI2, WinUI3/WinAppSDK, UWP(Universal Windows), etc.
OS: Windows 11 Enterprise Version 22H2

Regression
It worked properly before the security update patch KB5030219 was installed, but it will not work properly after this update is installed.

Repro Steps

  1. Visit the website "https://support.microsoft.com/en-us/topic/september-12-2023-kb5030219-os-build-22621-2283-8b9ba74f-fdde-4c75-b049 -77cf214f4a66" Download and install the security update KB5030219 for Windows 11.
  2. Open Visual Studio Enterprise 2022 and select File=> New=> Project... ; Then select C# & Windows & UWP, click Blank App(Universal Windows), enter in the project name "BrowserApp" and click Create button to generate a UWP application.
  3. Right-click the project you just created and select "Manage NuGet Packages..." , search and add NuGet packages "Microsoft.UI.Xaml" & "Microsoft.Web.WebView2".
  4. Double-click the "Package. appxmanifest" file in the project solution, and checked the "Shared User Certificates" item in the list option of the Capabilities table page.
  5. Finally, type the following code in the "MainPage.xaml "&" MainPage.xaml.cs "files, then debug and run to reproduce the problem described.

MainPage.xaml Code:

<Page
    x:Class="BrowserApp.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:BrowserApp"
    xmlns:controls="using:Microsoft.UI.Xaml.Controls"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    Loaded="BrowserWindow_Loaded">

    <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <CommandBar x:Name="appCommandBar" Grid.Column="0" OverflowButtonVisibility="Collapsed">
                <AppBarButton IsCompact="True" Icon="Back" Click="AppBarButton_BackClick">
                </AppBarButton>
                <AppBarButton IsCompact="True" Icon="Cancel" Click="AppBarButton_CancelClick">
                </AppBarButton>
            </CommandBar>
            <TextBox Grid.Column="1" x:Name="txtUrl" Text="https://mobilestg-ae3be903b.hana.ondemand.com/SAMLAuthLauncher" 
                     HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Center" Margin="5,0,0,0" Width="520"
                     KeyDown="txtUrl_KeyDown" />
            <Button Grid.Column="2" x:Name="btnNavigate" Content="Go" HorizontalAlignment="Left" VerticalAlignment="Center"
                     Margin="5,0,0,0" Click="btnNavigate_Click"/>
        </Grid>
        <controls:WebView2 x:Name="wvBrowser" Grid.Row="1" Source="about:blank"/>

    </Grid>
</Page>

MainPage.xaml.cs Code:

using Microsoft.UI.Xaml.Controls;
using Microsoft.Web.WebView2.Core;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409

namespace BrowserApp
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class MainPage : Page
    {
        public MainPage()
        {
            this.InitializeComponent();
        }
        private void BrowserWindow_Loaded(object sender, RoutedEventArgs e)
        {
            wvBrowser.Focus(FocusState.Keyboard);            
        }

        private void AppBarButton_CancelClick(object sender, RoutedEventArgs e)
        {
            wvBrowser.CoreWebView2.Stop();
        }

        private void AppBarButton_BackClick(object sender, RoutedEventArgs e)
        {
            wvBrowser.CoreWebView2.Stop();
            if (wvBrowser.CanGoBack)
                wvBrowser.GoBack();
        }

        private void txtUrl_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if(e.Key == Windows.System.VirtualKey.Enter)
            {
                btnNavigate_Click(null, null);
            }
        }

        private void btnNavigate_Click(object sender, RoutedEventArgs e)
        {
            string url = txtUrl.Text.Trim();
            if (!string.IsNullOrEmpty(url))
                wvBrowser.Source = new Uri(url);
        }
    }
}

This problem only occurs when security patch KB5030219 is installed, It is not clear why this affects the functionality of the WebView2 dev kit, but it seems to disable all WebView2 keyboard events after the x.509 certificate selection is displayed. But I didn't find any Settings that enable or set WebView2 to enable keyboard event listeners.

During the test, I found that you can uncheck the option of "Shared User Certificates" and it will work normally, but the functional business needs to require the option of x.509.

I also asked questions in the Microsoft tech community: https://learn.microsoft.com/en-us/answers/questions/1373790/windows-11-update-kb5030219-unable-to-enter-issue

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.