Skip to content

[iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null#34741

Merged
kubaflo merged 9 commits into
dotnet:inflight/currentfrom
Shalini-Ashokan:fix-34611
Apr 10, 2026
Merged

[iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null#34741
kubaflo merged 9 commits into
dotnet:inflight/currentfrom
Shalini-Ashokan:fix-34611

Conversation

@Shalini-Ashokan
Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details

On iOS and macCatalyst, setting BackgroundColor = null on an Entry or Editor at runtime does not restore the native default appearance. Once a custom color is applied, it persists even after the property is cleared.

Root Cause

The shared iOS background update logic only resets BackgroundColor = null for LayoutView subclasses — all other UIView types silently return. MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView subclasses, so the reset is skipped.

Description of Change

Platform-specific MapBackground methods were added to EntryHandler.iOS.cs and EditorHandler.iOS.cs. When Background.IsNullOrEmpty(), they now explicitly set platformView.BackgroundColor = null to restore native appearance.

Validated the behavior in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #34611

Output ScreenShot

Before After
34611-BeforeFix.mov
34611-AfterFix.mov

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 30, 2026

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34741

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34741"

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Mar 30, 2026
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Hey there @@Shalini-Ashokan! 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 Mar 30, 2026
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

Fixes an iOS/macCatalyst-specific handler behavior where clearing Entry/Editor background (setting BackgroundColor = null) did not restore the native default appearance, by adding platform-specific MapBackground implementations that explicitly reset the native BackgroundColor and remove any background layer.

Changes:

  • Add iOS/macCatalyst EntryHandler.MapBackground and EditorHandler.MapBackground to properly handle Background.IsNullOrEmpty() resets.
  • Update PublicAPI.Unshipped.txt for net-ios and net-maccatalyst to include the new handler mapping APIs.
  • Add a new UI test page + Appium test for Issue #34611 and an iOS snapshot baseline.

Reviewed changes

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

Show a summary per file
File Description
src/Core/src/Handlers/Entry/EntryHandler.iOS.cs Adds iOS/macCatalyst MapBackground to clear background layers and reset native BackgroundColor when background is null/empty.
src/Core/src/Handlers/Editor/EditorHandler.iOS.cs Adds iOS/macCatalyst MapBackground with the same reset behavior for Editor.
src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt Declares the new MapBackground APIs for iOS.
src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt Declares the new MapBackground APIs for MacCatalyst.
src/Controls/tests/TestCases.HostApp/Issues/Issue34611.cs Adds the HostApp repro page for the issue with relevant AutomationIds.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34611.cs Adds an Appium UI test validating the reset behavior via a screenshot assertion.
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull.png Adds iOS snapshot baseline for the new screenshot test.

Comment on lines +15 to +23
[Test]
[Category(UITestCategories.Entry)]
public void EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull()
{
App.WaitForElement("ApplyBackgroundColorButton");
App.Tap("ApplyBackgroundColorButton");
App.WaitForElement("TestEntry");
App.Tap("ResetToDefaultButton");
VerifyScreenshot();
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

This UI screenshot test will execute in every platform test project that links in TestCases.Shared.Tests, but the PR only adds a baseline snapshot under TestCases.iOS.Tests/snapshots/ios. VerifyScreenshot() will fail on other runners (Android/Windows/macCatalyst) and also on iOS 26 where the environment name switches to ios-26 and expects a baseline under snapshots/ios-26. Either scope the test to iOS+MacCatalyst (e.g., file-level #if IOS || MACCATALYST / Assert.Ignore on other platforms) and add the corresponding mac + ios-26 baselines, or add baselines for all platforms where it will run.

Copilot uses AI. Check for mistakes.
Comment on lines +19 to +23
App.WaitForElement("ApplyBackgroundColorButton");
App.Tap("ApplyBackgroundColorButton");
App.WaitForElement("TestEntry");
App.Tap("ResetToDefaultButton");
VerifyScreenshot();
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

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

After tapping "ResetToDefaultButton", the visual update may not be fully applied by the time the screenshot is taken, which can make this test flaky. Prefer using VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(...)) (and/or an explicit wait for a stable UI condition) instead of taking the screenshot immediately.

Copilot uses AI. Check for mistakes.
@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Apr 2, 2026

🚦 Gate - Test Before and After Fix

📊 Expand Full Gate061dedc · committed the base snapshots

Gate Result: ✅ PASSED

Platform: IOS · Base: main · Merge base: b43bdad1

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue34611 Issue34611 ✅ FAIL — 221s ✅ PASS — 89s
🔴 Without fix — 🖥️ Issue34611: FAIL ✅ · 221s
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 615 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 627 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 9.97 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj (in 17.4 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/maps/src/Maps.csproj (in 17.41 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 17.4 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Foldable/src/Controls.Foldable.csproj (in 17.42 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj (in 17.41 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Maps/src/Controls.Maps.csproj (in 17.41 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 17.43 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 17.43 sec).
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
  Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Detected signing identity:
    Code Signing Key: "" (-)
    Provisioning Profile: "" () - no entitlements
    Bundle Id: com.microsoft.maui.uitests
    App Id: com.microsoft.maui.uitests
  Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.

Build succeeded.

/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:01:38.90
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/CustomAttributes/Controls.CustomAttributes.csproj (in 810 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Core/UITest.Core.csproj (in 810 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 810 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj (in 810 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 810 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 810 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 969 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 983 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.NUnit/UITest.NUnit.csproj (in 1.64 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Appium/UITest.Appium.csproj (in 2.83 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj (in 5.94 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj (in 9.98 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj (in 10.84 sec).
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
/Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.04]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.13]   Discovered:  Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 4/9/2026 7:56:46 AM FixtureSetup for Issue34611(iOS)
>>>>> 4/9/2026 7:56:49 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Start
>>>>> 4/9/2026 7:56:52 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Stop
>>>>> 4/9/2026 7:56:52 AM Log types: syslog, crashlog, performance, safariConsole, safariNetwork, server
  Failed EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull [3 s]
  Error Message:
   VisualTestUtils.VisualTestFailedException : 
Snapshot different than baseline: EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull.png (6.91% difference)
If the correct baseline has changed (this isn't a a bug), then update the baseline image.
See test attachment or download the build artifacts to get the new snapshot file.

More info: https://aka.ms/visual-test-workflow

  Stack Trace:
     at VisualTestUtils.VisualRegressionTester.Fail(String message) in /_/src/TestUtils/src/VisualTestUtils/VisualRegressionTester.cs:line 162
   at VisualTestUtils.VisualRegressionTester.VerifyMatchesSnapshot(String name, ImageSnapshot actualImage, String environmentName, ITestContext testContext) in /_/src/TestUtils/src/VisualTestUtils/VisualRegressionTester.cs:line 123
   at Microsoft.Maui.TestCases.Tests.UITest.<VerifyScreenshot>g__Verify|13_0(String name, <>c__DisplayClass13_0&) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 477
   at Microsoft.Maui.TestCases.Tests.UITest.VerifyScreenshot(String name, Nullable`1 retryDelay, Nullable`1 retryTimeout, Int32 cropLeft, Int32 cropRight, Int32 cropTop, Int32 cropBottom, Double tolerance) in /_/src/Controls/tests/TestCases.Shared.Tests/UITest.cs:line 309
   at Microsoft.Maui.TestCases.Tests.Issues.Issue34611.EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue34611.cs:line 23
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

NUnit Adapter 4.5.0.0: Test execution complete

Total tests: 1
     Failed: 1
Test Run Failed.
 Total time: 1.0304 Minutes

🟢 With fix — 🖥️ Issue34611: PASS ✅ · 89s
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 405 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 417 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 421 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 455 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 468 ms).
  6 of 11 projects are up-to-date for restore.
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
  Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
  Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Detected signing identity:
    Code Signing Key: "" (-)
    Provisioning Profile: "" () - no entitlements
    Bundle Id: com.microsoft.maui.uitests
    App Id: com.microsoft.maui.uitests
  Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.

Build succeeded.

/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:43.84
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 454 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 501 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 500 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 524 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 537 ms).
  8 of 13 projects are up-to-date for restore.
  Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.60-ci+azdo.13788327
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
/Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.04]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.14]   Discovered:  Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 4/9/2026 7:58:17 AM FixtureSetup for Issue34611(iOS)
>>>>> 4/9/2026 7:58:21 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Start
>>>>> 4/9/2026 7:58:22 AM EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull Stop
  Passed EntryAndEditorBackgroundColorShouldResetToDefaultWhenSetToNull [1 s]
NUnit Adapter 4.5.0.0: Test execution complete

Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 18.5236 Seconds

📁 Fix files reverted (5 files)
  • eng/pipelines/ci-copilot.yml
  • src/Core/src/Handlers/Editor/EditorHandler.iOS.cs
  • src/Core/src/Handlers/Entry/EntryHandler.iOS.cs
  • src/Core/src/PublicAPI/net-ios/PublicAPI.Unshipped.txt
  • src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt

@MauiBot
Copy link
Copy Markdown
Collaborator

MauiBot commented Apr 2, 2026

🤖 AI Summary

📊 Expand Full Review061dedc · committed the base snapshots
🔍 Pre-Flight — Context & Validation

Issue: #34611 - [iOS, Maccatalyst] Entry & Editor BackgroundColor not reset to Null
PR: #34741 - [iOS/macCatalyst] Fix Entry and Editor BackgroundColor reset when set to null
Platforms Affected: iOS, macCatalyst
Files Changed: 4 implementation (2 handler files + 2 PublicAPI.Unshipped.txt), 7 test/snapshot

Key Findings

  • Root Cause: ViewExtensions.UpdateBackground() (iOS) only sets BackgroundColor = null for LayoutView or ContentView subclasses. MauiTextField (Entry) and MauiTextView (Editor) are neither, so the null-reset path silently returns early, leaving the previously applied background color.
  • Fix approach: Add iOS-specific MapBackground overrides to EntryHandler.iOS.cs and EditorHandler.iOS.cs. When Background.IsNullOrEmpty(), they call RemoveBackgroundLayer() + platformView.BackgroundColor = null to restore native appearance. For ImageSourcePaint, async load; for everything else, delegate to platformView.UpdateBackground(entry/editor).
  • Mapper wiring: Both EntryHandler.cs and EditorHandler.cs already map [nameof(IView.Background)] = MapBackground, so the new iOS override is picked up automatically.
  • PublicAPI.Unshipped.txt: Both net-ios and net-maccatalyst correctly updated with the two new public static MapBackground signatures.
  • Structural inconsistency: EditorHandler.iOS.cs MapBackground is missing an explicit return; after the FireAndForget() call in the ImageSourcePaint branch (while EntryHandler.iOS.cs has it). Functionally harmless (else-if/else structure prevents fall-through) but style is inconsistent.
  • Test baselines: PR now includes snapshots for ios, ios-26, mac, android, and windows. All platform runners should have baselines.
  • Test flakiness concern: VerifyScreenshot() is called immediately after App.Tap("ResetToDefaultButton") with no retryTimeout. PR author says it passes reliably, but the UI guidelines recommend retryTimeout for post-interaction screenshots.
  • Prior agent review (3264dac): A previous agent pass identified the same concerns; PR author addressed the "simpler root-cause fix" concern (removing LayoutView guard globally breaks initial rendering) and confirmed snapshots were being added.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #34741 Override MapBackground in EntryHandler.iOS.cs + EditorHandler.iOS.cs; null/empty → RemoveBackgroundLayer() + BackgroundColor = null ✅ PASSED (Gate) EntryHandler.iOS.cs, EditorHandler.iOS.cs, PublicAPI.Unshipped.txt ×2, Issue34611.cs ×2, 5 snapshots Original PR

🔧 Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #34741 Override MapBackground in EntryHandler.iOS.cs + EditorHandler.iOS.cs; null/empty → RemoveBackgroundLayer() + BackgroundColor = null ✅ PASSED (Gate) EntryHandler.iOS.cs, EditorHandler.iOS.cs, PublicAPI.Unshipped.txt ×2 Original PR — per-handler approach
1 try-fix (claude-opus-4.6) Expand ViewExtensions.UpdateBackground() type check: LayoutView or ContentView or MauiTextField or MauiTextView — 1-line change in shared utility ✅ PASS ViewExtensions.cs (+1/-1) Simplest fix; centralized; any future text view inheriting these types auto-benefits
2 try-fix (claude-sonnet-4.6) Add IDefaultBackgroundResettable marker interface; MauiTextField/MauiTextView implement it; ViewExtensions checks interface ✅ PASS IDefaultBackgroundResettable.cs (new), MauiTextField.cs, MauiTextView.cs, ViewExtensions.cs Open/Closed compliant; new types can opt in without touching ViewExtensions
3 try-fix (gpt-5.3-codex) Modify shared ViewHandler.MapBackground + ViewExtensions to detect iOS text input types ✅ PASS ViewHandler.cs, ViewExtensions.cs Cross-cutting approach; touches shared handler base
4 try-fix (gpt-5.4) Add typed UpdateBackground overloads for MauiTextField/MauiTextView in ViewExtensions; route via type dispatch ✅ PASS ViewExtensions.cs Overload-based dispatch; specialized but contained to ViewExtensions

Cross-Pollination

Model Round New Ideas? Details
claude-opus-4.6 2 Yes Platform-view-level default capture — store default BackgroundColor in constructor, expose ResetBackgroundToDefault() method. Noted as architectural preference, not materially different.
gpt-5.3-codex 2 No NO NEW IDEAS

Exhausted: Yes — both models queried in Round 2; no actionable new approaches.

Selected Fix: Candidate #1 (Attempt 1 — expand type check in ViewExtensions.cs) is the simplest passing alternative, but the PR's fix is also valid and correct. See Report for comparison and recommendation.


📋 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Phase Status

Phase Status Notes
Pre-Flight ✅ COMPLETE iOS/macCatalyst bug; 4 impl files + 7 test/snapshot files
Gate ✅ PASSED iOS — test fails without fix, passes with fix
Try-Fix ✅ COMPLETE 4 attempts, all 4 PASSING
Report ✅ COMPLETE

Summary

The PR correctly identifies and fixes a real bug: ViewExtensions.UpdateBackground() only resets BackgroundColor = null for LayoutView/ContentView subclasses, silently skipping MauiTextField (Entry) and MauiTextView (Editor). The fix works and Gate passed. However, the chosen approach adds two new public API methods (EntryHandler.MapBackground, EditorHandler.MapBackground) that are now in PublicAPI.Unshipped.txt — when a simpler one-line fix in ViewExtensions.cs achieves the same result without any API surface change. There are also two minor quality issues in the test and code.

Root Cause

ViewExtensions.UpdateBackground(UIView, Paint) at line 86 of src/Core/src/Platform/iOS/ViewExtensions.cs:

if (paint.IsNullOrEmpty())
{
    if (platformView is LayoutView or ContentView)  // MauiTextField/MauiTextView excluded
        platformView.BackgroundColor = null;
    else
        return;  // silently returns — null reset never happens for Entry/Editor
}

Fix Quality

What the PR does: Adds MapBackground override overloads to EntryHandler.iOS.cs and EditorHandler.iOS.cs. Each handles three cases: ImageSourcePaint, IsNullOrEmpty()RemoveBackgroundLayer() + BackgroundColor = null, and the solid/gradient case via UpdateBackground().

Concerns:

1. 🔴 Unnecessary Public API Surface

Two new public static methods are added to PublicAPI.Unshipped.txt:

static Microsoft.Maui.Handlers.EditorHandler.MapBackground(...) -> void
static Microsoft.Maui.Handlers.EntryHandler.MapBackground(...) -> void

Try-Fix Attempt 1 found a 1-line fix in the shared ViewExtensions.cs that passes all tests and requires zero public API changes:

-if (platformView is LayoutView or ContentView)
+if (platformView is LayoutView or ContentView or MauiTextField or MauiTextView)

This single change in UpdateBackground() is centralized, covers both Entry and Editor (and any future MauiTextField/MauiTextView subclass), and avoids expanding the public API. The PR's per-handler approach mirrors what the base ViewHandler.MapBackgroundUpdateBackground() already does for other cases, but adds 50+ lines and 2 public APIs to handle what was a 1-line omission.

2. 🟡 Style Inconsistency in EditorHandler.iOS.cs

EntryHandler.iOS.cs has an explicit return; after FireAndForget(handler) in the ImageSourcePaint branch. EditorHandler.iOS.cs does not:

// EditorHandler.iOS.cs — missing return
if (editor.Background is ImageSourcePaint image)
{
    ...
    platformView.UpdateBackgroundImageSourceAsync(image.ImageSource, provider)
        .FireAndForget(handler);
    // ← NO return here (EntryHandler.iOS.cs has one)
}

Functionally harmless (the else if/else structure prevents fall-through), but inconsistent with the sibling handler file.

3. 🟡 Test: Missing retryTimeout in VerifyScreenshot()

App.Tap("ResetToDefaultButton");
VerifyScreenshot();  // ← no retryTimeout

UI guidelines recommend VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)) for screenshots taken immediately after a tap, to guard against animation timing variance across platforms and devices. The PR author says it passes reliably — acceptable, but the pattern is safer with retryTimeout.

Selected Fix: PR's fix (with changes requested)

The PR's fix passes, but the simpler ViewExtensions approach is preferable for avoiding public API expansion. If the author prefers to keep the handler-based approach, they should justify the public API addition (e.g., if external handler customization requires it).

Requested Changes

  1. [Required] Consider replacing the per-handler MapBackground overrides with the 1-line ViewExtensions.cs change (or MauiTextField or MauiTextView) to avoid adding public API. If per-handler overrides are preferred, explain why the public methods are needed.
  2. [Minor] Add return; after FireAndForget(handler) in EditorHandler.iOS.cs MapBackground for consistency with EntryHandler.iOS.cs.
  3. [Minor] Use VerifyScreenshot(retryTimeout: TimeSpan.FromSeconds(2)) in the UI test.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Apr 2, 2026
Copy link
Copy Markdown
Contributor

@kubaflo kubaflo left a comment

Choose a reason for hiding this comment

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

Could you please review the AI's summary?

@Shalini-Ashokan
Copy link
Copy Markdown
Contributor Author

Shalini-Ashokan commented Apr 7, 2026

🤖 AI Summary

📊 Expand Full Review3264dac · Modified the test

@kubaflo,
Concern 1 — Suggested simpler root-cause fix:
It was suggested to remove the LayoutView guard in ViewExtensions.UpdateBackground() to apply BackgroundColor = null to all UIView types. This breaks the initial rendering of Editor, Label, and Entry — setting BackgroundColor = null during the first mapper pass wipes their native defaults, since UpdateBackground runs even when no background was explicitly set.
Concern 2 — Suggested adding a delay before screenshot:
The test is passing reliably without any delay, so this concern is not applicable here.
Concern 3 — Suggested adding baselines for all platforms:
will be adding the snapshots soon.

@sheiksyedm
Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@MauiBot MauiBot added the s/agent-fix-win AI found a better alternative fix than the PR label Apr 9, 2026
@kubaflo kubaflo changed the base branch from main to inflight/current April 10, 2026 08:46
@kubaflo kubaflo merged commit 0a41205 into dotnet:inflight/current Apr 10, 2026
3 of 13 checks passed
PureWeen pushed a commit that referenced this pull request Apr 14, 2026
… to null (#34741)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
On iOS and macCatalyst, setting BackgroundColor = null on an Entry or
Editor at runtime does not restore the native default appearance. Once a
custom color is applied, it persists even after the property is cleared.

### Root Cause
The shared iOS background update logic only resets BackgroundColor =
null for LayoutView subclasses — all other UIView types silently return.
MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView
subclasses, so the reset is skipped.

### Description of Change
Platform-specific MapBackground methods were added to
EntryHandler.iOS.cs and EditorHandler.iOS.cs. When
Background.IsNullOrEmpty(), they now explicitly set
platformView.BackgroundColor = null to restore native appearance.
 
Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #34611   

### Output  ScreenShot

|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/5ca30c6d-c069-4c04-989b-4dae36584cb4"
>| <video
src="https://github.com/user-attachments/assets/ee9e2a2e-c210-47cc-9f85-2526780d398b">|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
devanathan-vaithiyanathan pushed a commit to Tamilarasan-Paranthaman/maui that referenced this pull request Apr 21, 2026
… to null (dotnet#34741)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
On iOS and macCatalyst, setting BackgroundColor = null on an Entry or
Editor at runtime does not restore the native default appearance. Once a
custom color is applied, it persists even after the property is cleared.

### Root Cause
The shared iOS background update logic only resets BackgroundColor =
null for LayoutView subclasses — all other UIView types silently return.
MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView
subclasses, so the reset is skipped.

### Description of Change
Platform-specific MapBackground methods were added to
EntryHandler.iOS.cs and EditorHandler.iOS.cs. When
Background.IsNullOrEmpty(), they now explicitly set
platformView.BackgroundColor = null to restore native appearance.
 
Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes dotnet#34611   

### Output  ScreenShot

|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/5ca30c6d-c069-4c04-989b-4dae36584cb4"
>| <video
src="https://github.com/user-attachments/assets/ee9e2a2e-c210-47cc-9f85-2526780d398b">|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
PureWeen pushed a commit that referenced this pull request Apr 22, 2026
… to null (#34741)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
On iOS and macCatalyst, setting BackgroundColor = null on an Entry or
Editor at runtime does not restore the native default appearance. Once a
custom color is applied, it persists even after the property is cleared.

### Root Cause
The shared iOS background update logic only resets BackgroundColor =
null for LayoutView subclasses — all other UIView types silently return.
MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView
subclasses, so the reset is skipped.

### Description of Change
Platform-specific MapBackground methods were added to
EntryHandler.iOS.cs and EditorHandler.iOS.cs. When
Background.IsNullOrEmpty(), they now explicitly set
platformView.BackgroundColor = null to restore native appearance.
 
Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #34611   

### Output  ScreenShot

|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/5ca30c6d-c069-4c04-989b-4dae36584cb4"
>| <video
src="https://github.com/user-attachments/assets/ee9e2a2e-c210-47cc-9f85-2526780d398b">|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
PureWeen pushed a commit that referenced this pull request Apr 28, 2026
… to null (#34741)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
On iOS and macCatalyst, setting BackgroundColor = null on an Entry or
Editor at runtime does not restore the native default appearance. Once a
custom color is applied, it persists even after the property is cleared.

### Root Cause
The shared iOS background update logic only resets BackgroundColor =
null for LayoutView subclasses — all other UIView types silently return.
MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView
subclasses, so the reset is skipped.

### Description of Change
Platform-specific MapBackground methods were added to
EntryHandler.iOS.cs and EditorHandler.iOS.cs. When
Background.IsNullOrEmpty(), they now explicitly set
platformView.BackgroundColor = null to restore native appearance.
 
Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #34611   

### Output  ScreenShot

|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/5ca30c6d-c069-4c04-989b-4dae36584cb4"
>| <video
src="https://github.com/user-attachments/assets/ee9e2a2e-c210-47cc-9f85-2526780d398b">|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
PureWeen pushed a commit that referenced this pull request Apr 29, 2026
… to null (#34741)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
On iOS and macCatalyst, setting BackgroundColor = null on an Entry or
Editor at runtime does not restore the native default appearance. Once a
custom color is applied, it persists even after the property is cleared.

### Root Cause
The shared iOS background update logic only resets BackgroundColor =
null for LayoutView subclasses — all other UIView types silently return.
MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView
subclasses, so the reset is skipped.

### Description of Change
Platform-specific MapBackground methods were added to
EntryHandler.iOS.cs and EditorHandler.iOS.cs. When
Background.IsNullOrEmpty(), they now explicitly set
platformView.BackgroundColor = null to restore native appearance.
 
Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #34611   

### Output  ScreenShot

|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/5ca30c6d-c069-4c04-989b-4dae36584cb4"
>| <video
src="https://github.com/user-attachments/assets/ee9e2a2e-c210-47cc-9f85-2526780d398b">|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
github-actions Bot pushed a commit that referenced this pull request May 6, 2026
… to null (#34741)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details
On iOS and macCatalyst, setting BackgroundColor = null on an Entry or
Editor at runtime does not restore the native default appearance. Once a
custom color is applied, it persists even after the property is cleared.

### Root Cause
The shared iOS background update logic only resets BackgroundColor =
null for LayoutView subclasses — all other UIView types silently return.
MauiTextField (Entry) and MauiTextView (Editor) are not LayoutView
subclasses, so the reset is skipped.

### Description of Change
Platform-specific MapBackground methods were added to
EntryHandler.iOS.cs and EditorHandler.iOS.cs. When
Background.IsNullOrEmpty(), they now explicitly set
platformView.BackgroundColor = null to restore native appearance.
 
Validated the behavior in the following platforms
 
- [x] Android
- [x] Windows
- [x] iOS
- [x] Mac
 
### Issues Fixed
  
Fixes #34611   

### Output  ScreenShot

|Before|After|
|--|--|
| <video
src="https://github.com/user-attachments/assets/5ca30c6d-c069-4c04-989b-4dae36584cb4"
>| <video
src="https://github.com/user-attachments/assets/ee9e2a2e-c210-47cc-9f85-2526780d398b">|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo pushed a commit that referenced this pull request May 7, 2026
…caused by BackgroundColor reset on initial handler connection (#35343)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Root Cause of the Regression
PR #34741's MapBackground overrides call platformView.BackgroundColor =
null during initial handler connection (when Background is null by
default), making Editor controls transparent at startup — breaking
shadow rendering and app-theme color bindings.


### Description of Change
In EditorHandler.iOS.cs, replaced platformView.BackgroundColor = null
with platformView.BackgroundColor = ColorExtensions.BackgroundColor
(UIColor.SystemBackground) so the Editor restores the system's adaptive
default color instead of becoming transparent. This preserves shadow
rendering on initial load and correctly responds to light/dark theme
changes.

 
### Issues Fixed
UI Test

iOS:
VerifyEditorPlaceholderWithShadow, VerifyEditor_WithShadow,
ShadowsDontRespectControlShape
 
Mac:
VerifyEditorPlaceholderWithShadow, VerifyEditor_WithShadow,
ShadowsDontRespectControlShape,
EditorAndEntryInputFieldsShouldChangeColorsOnAppThemeChange,
EntryAndEditorPlaceholderTextColorAppThemeBindingUpdatesOnThemeChange,
EntryAndEditorTextColorAppThemeBindingUpdatesOnThemeChange - Fails due
to this PR - #34741
@github-actions github-actions Bot locked and limited conversation to collaborators May 10, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-editor Editor area-controls-entry Entry community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS, Maccatalyst] Entry & Editor BackgroundColor not reset to Null

6 participants