Skip to content

[Windows] Fix for FlowDirection="RightToLeft" causes mirrored content in WebView and HybridWebView#30709

Merged
jfversluis merged 10 commits into
dotnet:inflight/currentfrom
HarishwaranVijayakumar:fix-30575
Sep 3, 2025
Merged

[Windows] Fix for FlowDirection="RightToLeft" causes mirrored content in WebView and HybridWebView#30709
jfversluis merged 10 commits into
dotnet:inflight/currentfrom
HarishwaranVijayakumar:fix-30575

Conversation

@HarishwaranVijayakumar
Copy link
Copy Markdown
Contributor

Issue Details

  • When setting the FlowDirection to RightToLeft, the content within the WebView and HybridWebView appears mirrored on Windows.

Description of Change

  • Added a MapFlowDirection override to both the WebView and HybridWebView handlers to prevent setting WebView2.FlowDirection, avoiding mirrored content in RightToLeft mode on Windows and ensuring consistent behavior across all platforms.

Issues Fixed

Fixes #30575

Tested the behaviour in the following platforms

  • - Windows
  • - Android
  • - iOS
  • - Mac

Output

Before Fix After Fix

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Jul 18, 2025
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey there @@HarishwaranVijayakumar! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 18, 2025
@HarishwaranVijayakumar HarishwaranVijayakumar marked this pull request as ready for review July 18, 2025 11:29
Copilot AI review requested due to automatic review settings July 18, 2025 11:29
@HarishwaranVijayakumar HarishwaranVijayakumar requested a review from a team as a code owner July 18, 2025 11:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a Windows-specific issue where setting FlowDirection="RightToLeft" causes web content to appear mirrored in WebView and HybridWebView controls. The fix prevents the underlying WebView2 control from inheriting the flow direction setting, ensuring content displays correctly while maintaining proper RTL behavior for the container.

Key Changes:

  • Added Windows-specific FlowDirection mapping overrides for both WebView and HybridWebView handlers
  • Implemented no-op MapFlowDirection methods that prevent base ViewHandler behavior from affecting WebView2
  • Added comprehensive UI test to validate the fix

Reviewed Changes

Copilot reviewed 6 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
WebViewHandler.cs Added Windows-specific FlowDirection property mapping
WebViewHandler.Windows.cs Implemented no-op MapFlowDirection override to prevent content mirroring
HybridWebViewHandler.cs Added Windows-specific FlowDirection property mapping
HybridWebViewHandler.Windows.cs Implemented no-op MapFlowDirection override for HybridWebView
Issue30575.cs (TestCases.Shared.Tests) Added UI test to verify WebView content is not mirrored with RTL flow direction
Issue30575.cs (TestCases.HostApp) Created test page demonstrating WebView with RTL flow direction

Comment thread src/Controls/tests/TestCases.HostApp/Issues/Issue30575.cs
Copy link
Copy Markdown
Member

@jfversluis jfversluis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See Copilot comment about the 3 second timeout.

Also, should BlazorWebView be included in this?

@HarishwaranVijayakumar
Copy link
Copy Markdown
Contributor Author

Yes, BlazorWebView is included too, since the issue happens there as well.

@jfversluis
Copy link
Copy Markdown
Member

@HarishwaranVijayakumar but I don't see any changes to BlazorWebView related files. Is that not needed?

@HarishwaranVijayakumar
Copy link
Copy Markdown
Contributor Author

@jfversluis, I have committed the changes for BlazorWebView.

@jfversluis jfversluis changed the base branch from main to inflight/current September 3, 2025 09:09
@jfversluis jfversluis added this to the .NET 9 SR11 milestone Sep 3, 2025
@jfversluis jfversluis merged commit 4b6f6b8 into dotnet:inflight/current Sep 3, 2025
1 check passed
PureWeen pushed a commit that referenced this pull request Sep 8, 2025
)

Fix updated

Revert "Prevent FlowDirection from affecting WebView2 content on Windows"

This reverts commit 406b01c.

Reapply "Prevent FlowDirection from affecting WebView2 content on Windows"

This reverts commit 355cfe2.

Added TestCase

Testcase Modified

Revert "Fix updated"

This reverts commit 78ac95e.

Added comment

Add fix for BlazorWebView
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Windows] FlowDirection="RightToLeft" causes mirrored content in WebView and HybridWebView

5 participants