Skip to content

[Android] Fixed: SearchHandler not displaying default search and clear icons #29981

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

Conversation

Tamilarasan-Paranthaman
Copy link
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!

Root Cause of the issue

  • In the current implementation, the default icons were not assigned to the buttons when the user did not explicitly provide custom icons in the SearchHandler. As a result, the clear button was rendered without an icon, although it remained interactable and performed the expected clear action when tapped.

Description of Change

  • Updated the logic to assign default icons to the search and clear buttons when custom icons are not provided in the SearchHandler. This ensures that the default icons are properly displayed, resolving the issue on Android.

Issues Fixed

Fixes #29973

Tested the behaviour in the following platforms

  • Android
  • iOS
  • Mac
  • Windows

Screenshot

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

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 13, 2025
Copy link
Contributor

Hey there @@Tamilarasan-Paranthaman! 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 Jun 13, 2025
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman marked this pull request as ready for review June 13, 2025 13:09
@Copilot Copilot AI review requested due to automatic review settings June 13, 2025 13:09
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman requested a review from a team as a code owner June 13, 2025 13:09
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 ensures that Android’s SearchHandler displays default search and clear icons when no custom icons are provided.

  • Updated the Android handler to assign default icon resources if no custom image is set.
  • Added a sample HostApp page to configure and trigger the SearchHandler.
  • Introduced a UI test to automate tapping the trigger and capturing a screenshot.

Reviewed Changes

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

File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29973.cs New UI test class that taps the trigger button and takes a screenshot
src/Controls/tests/TestCases.HostApp/Issues/Issue29973.cs HostApp sample initializing SearchHandler and a button to trigger it
src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellSearchView.cs Handler update: use default icon resources when no custom image set
Comments suppressed due to low confidence (2)

src/Controls/src/Core/Compatibility/Handlers/Shell/Android/ShellSearchView.cs:330

  • Please update the public XML docs under /docs/ to describe that default SearchHandler icons are now assigned when no custom icons are provided, so documentation matches the new behavior.
else if (defaultImage != -1)

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue29973.cs:21

  • [nitpick] Consider adding an assertion to explicitly verify that the default search and clear icons are visible after invoking the handler, rather than relying solely on a screenshot comparison.
VerifyScreenshot();

else if (defaultImage != -1)
{
// If the icon is not set, use the default icon
result.SetImageResource(defaultImage);
Copy link
Preview

Copilot AI Jun 13, 2025

Choose a reason for hiding this comment

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

Default icons set via SetImageResource lack a content description, which may hinder accessibility; consider calling AutomationPropertiesProvider.SetContentDescription with a suitable description for the default icons.

Suggested change
result.SetImageResource(defaultImage);
result.SetImageResource(defaultImage);
AutomationPropertiesProvider.SetContentDescription(result, "Default icon", null, null);

Copilot uses AI. Check for mistakes.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@aheubusch
Copy link
Contributor

Fyi, a PR fixing the same bug was recently merged #25067

@sheiksyedm
Copy link
Contributor

Closing in favour of #25067

@sheiksyedm sheiksyedm closed this Jun 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.

[Android] Missing default search and clear icons in SearchHandler
4 participants