Skip to content

[iOS] Fix for Transparent Background Color not applied to WebView #28804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 9, 2025

Conversation

Tamilarasan-Paranthaman
Copy link
Contributor

Root Cause of the issue

  • On iOS, the WebView is fully opaque by default. As a result, transparency settings are not applied, and any attempt to set a transparent background has no visible effect.

Description of Change

  • To resolve this, I set the opaque property of the WebView to false when a non-null background is provided. This allows the transparency to take effect as intended.

Issues Fixed

Fixes #28714

Tested the behaviour in the following platforms

  • iOS
  • Android
  • Windows
  • Mac

Screenshot

Before Fix After Fix
Before-Fix-Gif.mov
After-Fix-Gif.mov
Before-Fix.mov
After-Fix.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Apr 4, 2025
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as ready for review April 7, 2025 05:03
@Copilot Copilot AI review requested due to automatic review settings April 7, 2025 05:03
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman requested a review from a team as a code owner April 7, 2025 05:03
Copy link
Contributor

@Copilot 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.

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

var button = new Button
{
Text = "Change WebView BackgroundColor",
AutomationId = "button"
Copy link
Preview

Copilot AI Apr 7, 2025

Choose a reason for hiding this comment

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

The AutomationId 'button' is quite generic and may not be unique across the app; consider using a more descriptive and unique identifier (e.g., 'Issue28714ChangeBackgroundButton') to prevent potential clashes in UI testing.

Copilot uses AI. Check for mistakes.

@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

rmarinho commented Apr 7, 2025

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

Failing UITest on Android, HeaderFooterGridHorizontalWorks, is not related with the changes.

@rmarinho rmarinho added this to the .NET 9 SR6 milestone Apr 9, 2025
@rmarinho rmarinho merged commit 89946dd into dotnet:main Apr 9, 2025
124 of 129 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-webview WebView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issue with GIF Image on iOS – Transparent GIF Background Displays as White
3 participants