Skip to content
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

SearchBar does not unfocus and hide keyboard on iOS #11542

Closed
3steve3 opened this issue Nov 21, 2022 · 3 comments · Fixed by #11698
Closed

SearchBar does not unfocus and hide keyboard on iOS #11542

3steve3 opened this issue Nov 21, 2022 · 3 comments · Fixed by #11698
Assignees
Labels
area-controls-entry Entry fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! platform/iOS 🍎 t/bug Something isn't working

Comments

@3steve3
Copy link

3steve3 commented Nov 21, 2022

Description

I'm trying to create a search bar with some results in a list view that appear. When a user taps a result in the list view or presses search in the keyboard I try to unfocus the search bar to hide the keyboard, but the keyboard does not disappear even though the event fires and calls unfocus for the search bar.

Steps to Reproduce

  1. Create a new content page
  2. Add a searchbar and a list view
  3. Add event handler that unfocuses searchbar when a listview item is tapped
  4. Keyboard will not disappear

Link to public reproduction project repository

https://github.com/3steve3/SearchBarBug

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16

Did you find any workaround?

No response

Relevant log output

No response

@3steve3 3steve3 added the t/bug Something isn't working label Nov 21, 2022
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Nov 22, 2022
@PureWeen
Copy link
Member

The problem here is that the SearchBar element's "IsFocused" property doesn't toggle to True when it's focused. The UnFocus() call inside VisualElement checks the value of IsFocused before trying to trigger a focus call to the platform

image

One workaround is to manually set IsFocused yourself.

(searchBar as IView).IsFocused = true
searchBar.UnFocus()

I wonder if inside our VisualElement code we should be checking the platform as the ultimate truth if an element is focused. I realize that masks the IsFocused property being semi broken and not firing FocusChanged but it at least makes IsFocused always correct.

@PureWeen
Copy link
Member

This is basically a duplicate of #6482

@PureWeen PureWeen added this to the Backlog milestone Nov 22, 2022
@ghost
Copy link

ghost commented Nov 22, 2022

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

@jsuarezruiz jsuarezruiz self-assigned this Nov 28, 2022
@samhouts samhouts added the fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! label Apr 12, 2023
@ghost ghost locked as resolved and limited conversation to collaborators May 12, 2023
@samhouts samhouts modified the milestones: Backlog, .NET 8 May 24, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-entry Entry fixed-in-8.0.0-preview.3.8149 Look for this fix in 8.0.0-preview.3.8149! platform/iOS 🍎 t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants