diff --git a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_Basic.xaml.cs b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_Basic.xaml.cs index 9885f9b2fbcf..3aeddcaf3271 100644 --- a/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_Basic.xaml.cs +++ b/src/SamplesApp/UITests.Shared/Microsoft_UI_Xaml_Controls/WebView2Tests/WebView2_Basic.xaml.cs @@ -20,7 +20,7 @@ namespace UITests.Microsoft_UI_Xaml_Controls.WebView2Tests /// /// An empty page that can be used on its own or navigated to within a Frame. /// - [Uno.UI.Samples.Controls.Sample("WebView")] + [Uno.UI.Samples.Controls.Sample("WebView", IsManualTest = true, Description = "The WebView2 should be borderless and the Uno Platform website should be displayed.")] public sealed partial class WebView2_Basic : Page { public WebView2_Basic() diff --git a/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.Interop.wasm.cs b/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.Interop.wasm.cs index 82760d6a13c3..0424bca2235e 100644 --- a/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.Interop.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.Interop.wasm.cs @@ -20,6 +20,9 @@ internal static partial class NativeMethods [JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.buildImports")] internal static partial void BuildImports(string assembly); + [JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.initializeStyling")] + internal static partial void InitializeStyling(ElementId htmlId); + [JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.reload")] internal static partial void Reload(ElementId htmlId); @@ -44,9 +47,6 @@ internal static partial class NativeMethods [JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.setAttribute")] internal static partial void SetAttribute(ElementId htmlId, string attribute, string value); - [JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.setBackground")] - internal static partial void SetBackground(ElementId htmlId, string value); - [JSImport("globalThis.Microsoft.UI.Xaml.Controls.WebView.setupEvents")] internal static partial void SetupEvents(ElementId htmlId); diff --git a/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.wasm.cs b/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.wasm.cs index 01e336293770..b823850faabf 100644 --- a/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.wasm.cs +++ b/src/Uno.UI/UI/Xaml/Controls/WebView/Native/Wasm/NativeWebView.wasm.cs @@ -36,7 +36,7 @@ public NativeWebView(CoreWebView2 coreWebView, ElementId elementId) _coreWebView = coreWebView; _elementId = elementId; - NativeMethods.SetBackground(elementId, "transparent"); + NativeMethods.InitializeStyling(elementId); NativeMethods.SetupEvents(elementId); } diff --git a/src/Uno.UI/ts/Windows/UI/Xaml/Controls/WebView.ts b/src/Uno.UI/ts/Windows/UI/Xaml/Controls/WebView.ts index f19cadc65030..543a637c2d5c 100644 --- a/src/Uno.UI/ts/Windows/UI/Xaml/Controls/WebView.ts +++ b/src/Uno.UI/ts/Windows/UI/Xaml/Controls/WebView.ts @@ -44,8 +44,10 @@ namespace Microsoft.UI.Xaml.Controls { return (document.getElementById(htmlId)).getAttribute(name); } - static setBackground(htmlId: string, color: string) { - (document.getElementById(htmlId)).style.backgroundColor = color; + static initializeStyling(htmlId: string) { + const iframe = document.getElementById(htmlId) as HTMLIFrameElement; + iframe.style.backgroundColor = "transparent"; + iframe.style.border = "0"; } static setupEvents(htmlId: string) {