Bug 52828 - SearchBar Cancel Button not visible when Text is empty
Summary: SearchBar Cancel Button not visible when Text is empty
Status: ASSIGNED
Alias: None
Product: Forms
Classification: Xamarin
Component: iOS ()
Version: 2.3.3
Hardware: PC Windows
: Normal enhancement
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-02-26 12:41 UTC by Damir Beylkhanov
Modified: 2017-04-07 15:51 UTC (History)
6 users (show)

Tags: searchbar platformspecific behavior cancel
Is this bug a regression?: ---
Last known good build:


Attachments
cancel button missing when text in searchbar is empty (4.95 KB, image/png)
2017-02-26 12:41 UTC, Damir Beylkhanov
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 52828 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
ASSIGNED

Description Damir Beylkhanov 2017-02-26 12:41:33 UTC
Created attachment 19994 [details]
cancel button missing when text in searchbar is empty

When Text in the SearchBar is empty, the Cancel button is not visible. Only when Text is non-empty the Cancel button is displayed. 
So you can't dismiss the keyboard when Text is empty. I think the Cancel button should always be visible when the SearchBar has focus.
Comment 1 Paul DiPietro [MSFT] 2017-02-27 16:17:21 UTC
It appears that this is occurring due to how renderer code is structured; the ShowsCancelButton value is based on whether the text entered is null or empty, but I think that it might be possible to add a platform specific feature which would allow the Cancel Button to be shown all the time or not at all, which would appear to reflect how it works in the interface builder/native app. 

This would constitute a breaking change to some extent, but might be first worth a proposal in the evolution forum (https://forums.xamarin.com/categories/xamarin-forms-evolution). I'm going to mark this as an enhancement for the time being.
Comment 2 Rupreet Gujral 2017-03-19 18:16:26 UTC
Do we know when this will be fixed? Any timelines?
Comment 3 Mat 2017-04-07 15:51:05 UTC
I believe this is a bug more than an enhancement, it prevents the users from dismissing the keyboard when the text is empty. The default behavior for the iOS UISearchbar's ShowsCancelButton property is to display the cancel button as long as the searchbar is highlighted/focused (even if text is empty) and I think the Forms SearchBar should behave the same on iOS

I found a thread in the forums
https://forums.xamarin.com/discussion/59750/searchbar-cancel-button-not-visible-when-text-is-empty