KEMBAR78
[Android, iOS, MacOS] Fixed Entry ClearButton Color Not Updating on AppThemeBinding Change by NanthiniMahalingam · Pull Request #30817 · dotnet/maui · GitHub
Skip to content

Conversation

NanthiniMahalingam
Copy link
Contributor

@NanthiniMahalingam NanthiniMahalingam commented Jul 24, 2025

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

  • Entry ClearButton Color Not Updating on AppThemeBinding Change on Android, iOS and macOS platform

Root cause

  • On Android, the Entry clear button icon color does not update because the icon is not refreshed when the text color changes.
  • On iOS, the clear button color is not updated when the theme changes due to a missing call to the method responsible for updating the icon color.

Description of Change

  • On Android, I implemented an internal static method UpdateClearButtonColor in EditTextExtensions to update the clear button icon color. This method is invoked via the text color mapper in the Entry handler to ensure the clear button icon reflects theme and text color changes.
  • On iOS and macOS, I updated the text color mapper in the Entry handler to invoke UpdateClearButtonIconColor on the platform view. This ensures the clear button icon color is properly updated when the theme or text color changes.

Validated the behaviour in the following platforms

  • Android
  • Windows ,
  • iOS,
  • MacOS

Issues Fixed

Fixes #19997
Fixes #31326

Output images

Android

Before After
Before_Android.mov
After_Android.mov

iOS

Before After
Before_iOS.mov
After_iOS.mov

macOS

Before After
Before_macOS.mov
After_macOS.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Jul 24, 2025
@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Jul 25, 2025

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@NanthiniMahalingam NanthiniMahalingam marked this pull request as ready for review July 26, 2025 05:04
@Copilot Copilot AI review requested due to automatic review settings July 26, 2025 05:04
@NanthiniMahalingam NanthiniMahalingam requested a review from a team as a code owner July 26, 2025 05:04
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.

Pull Request Overview

This PR fixes a bug where the Entry control's clear button color does not update when the app theme changes on Android, iOS, and macOS platforms. The issue occurred because the clear button icon color was not being refreshed when the text color changed due to AppThemeBinding updates.

Key changes implemented:

  • Added a new method to update clear button color on Android when text color changes
  • Modified Entry handlers on iOS and macOS to call the clear button color update method when text color changes
  • Refactored Android clear button color logic to use the new extension method

Reviewed Changes

Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/Core/src/Platform/Android/EditTextExtensions.cs Added new UpdateClearButtonColor method to handle clear button icon color updates
src/Core/src/Handlers/Entry/EntryHandler.iOS.cs Modified MapTextColor to call clear button color update when clear button is visible
src/Core/src/Handlers/Entry/EntryHandler.Android.cs Updated MapTextColor and ShowClearButton to use the new color update method
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue19997.cs Added UI test to verify clear button color updates on theme change
src/Controls/tests/TestCases.HostApp/Issues/Issue19997.cs Created test page with Entry using AppThemeBinding and theme toggle button
Comments suppressed due to low confidence (1)

src/Core/src/Handlers/Entry/EntryHandler.Android.cs:86

  • [nitpick] The variable name 'platformHandler' is misleading since 'handler' is already the platform handler. Consider renaming to 'entryHandler' or 'concreteHandler' for clarity.
			if (handler is EntryHandler platformHandler && platformHandler._clearButtonVisible)

@jsuarezruiz
Copy link
Contributor

jsuarezruiz commented Jul 29, 2025

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis
Copy link
Member

/rebase

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

2 similar comments
@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jfversluis jfversluis changed the base branch from main to inflight/current September 1, 2025 12:34
@jfversluis jfversluis merged commit 312a1ed into dotnet:inflight/current Sep 1, 2025
1 check passed
@jfversluis jfversluis added this to the .NET 9 SR11 milestone Sep 1, 2025
PureWeen pushed a commit that referenced this pull request Sep 8, 2025
Added the fix for android platform

Remove unwanted code changes

Updated the code changes

Updated the code changes

Updated the fix

Updated the code changes

Added the test case

Added the output images

Updated the test case

Updated the fix

Added the pending snapshots

Updated the test case

Added the updated output images for mac and windows platform

Added the output images for entry feature matrix test case
@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-entry Entry community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/android platform/ios platform/macos macOS / Mac Catalyst

Projects

None yet

5 participants