Skip to content

Commit 23eab84

Browse files
authored
Merge pull request #19703 from unoplatform/dev/jela/wasm-webview-select
fix(webview): Don't allow for the webview iframe to be selected
2 parents b2985e2 + b38734e commit 23eab84

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Page x:Class="UITests.Shared.Windows_UI_Xaml.WebView2_OuterSelection"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:mux="using:Microsoft.UI.Xaml.Controls"
7+
xmlns:unoControls="using:Uno.UI.Samples.Controls"
8+
mc:Ignorable="d"
9+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
10+
11+
<StackPanel HorizontalAlignment="Center"
12+
VerticalAlignment="Center">
13+
14+
<mux:WebView2 Width="640"
15+
Height="480"
16+
Source="https://platform.uno" />
17+
18+
<Slider Orientation="Horizontal"
19+
AllowDrop="False"
20+
CanDrag="False"
21+
IsThumbToolTipEnabled="False"
22+
IsTrackerEnabled="False"
23+
Minimum="10"
24+
Maximum="140"
25+
Width="140"
26+
ManipulationMode="None"
27+
StepFrequency="10"></Slider>
28+
29+
</StackPanel>
30+
</Page>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using System;
2+
using Microsoft.UI.Xaml;
3+
using Microsoft.UI.Xaml.Controls;
4+
using Uno.UI.Samples.Controls;
5+
using SamplesApp.Microsoft_UI_Xaml_Controls.WebView2Tests;
6+
7+
namespace UITests.Shared.Windows_UI_Xaml
8+
{
9+
[Sample("WebView",
10+
Name = "WebView2_OuterSelection",
11+
IsManualTest = true,
12+
Description = "When trying to select the slider as if it were text, the WebView should not become selected (blue overlay).")]
13+
public sealed partial class WebView2_OuterSelection : Page
14+
{
15+
public WebView2_OuterSelection()
16+
{
17+
this.InitializeComponent();
18+
}
19+
}
20+
}

src/SamplesApp/UITests.Shared/UITests.Shared.projitems

+7
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,10 @@
474474
<SubType>Designer</SubType>
475475
<Generator>MSBuild:Compile</Generator>
476476
</Page>
477+
<Page Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\WebView2Tests\WebView2_OuterSelection.xaml">
478+
<SubType>Designer</SubType>
479+
<Generator>MSBuild:Compile</Generator>
480+
</Page>
477481
<Page Include="$(MSBuildThisFileDirectory)Msal\MsalLoginAndGraph.xaml">
478482
<SubType>Designer</SubType>
479483
<Generator>MSBuild:Compile</Generator>
@@ -5888,6 +5892,9 @@
58885892
<Compile Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\ExpanderTests\Expander_ScrollView.xaml.cs">
58895893
<DependentUpon>Expander_ScrollView.xaml</DependentUpon>
58905894
</Compile>
5895+
<Compile Include="$(MSBuildThisFileDirectory)Microsoft_UI_Xaml_Controls\WebView2Tests\WebView2_OuterSelection.xaml.cs">
5896+
<DependentUpon>WebView2_OuterSelection.xaml</DependentUpon>
5897+
</Compile>
58915898
<Compile Include="$(MSBuildThisFileDirectory)Msal\MsalLoginAndGraph.xaml.cs">
58925899
<DependentUpon>MsalLoginAndGraph.xaml</DependentUpon>
58935900
</Compile>

src/Uno.UI/WasmCSS/Uno.UI.css

+1
Original file line numberDiff line numberDiff line change
@@ -301,4 +301,5 @@ input::-ms-clear {
301301
border: 0px;
302302
width: 100%;
303303
height: 100%;
304+
user-select: none;
304305
}

0 commit comments

Comments
 (0)