-
Notifications
You must be signed in to change notification settings - Fork 332
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
input doesn't get focus when entering detached mode #653
Comments
Interestingly this doesn't happen on desktop Safari (even in detached mode). I wonder if this could be related to hover styles? |
It would be great if it could be an option exposed to the developer who could then choose between the two behaviours
|
I don't think this needs an option, not focusing is simply a bug @seafoox |
The input element does receive focus (notice the purple outline which comes from a This is probably related to the fact that iPhones don't let you programmatically assign focus (at least that was the case in the past), just like they don't allow you to autoplay videos, etc. We can set focus if this is done within a user event callback (which is the case here and it works) but we can't open the keyboard, this only happens when the user deliberately taps the input (we can't even simulate it). As far as I know there's no way around it.
@FabienMotte might have found a dark magic way around it 🔥 will try it! |
We've investigated this behavior and unfortunately, we can't work around it without introducing a hack. This hack forces us to change how we schedule DOM updates, which has unintended side-effects such as reopening the search modal on close when the query has been updated. We'll close it for now, as this is intentional browser behavior and there's no clean, non-invasive way around it. |
This is sad, but I understand why you don't want to fight the browser here... Would a better fix be to have the search box that a user sees on mobile that is actually a button right now, be the I don't know if it's possible, and if it is, it's probably a bunch of work. As of right now the search feels kind of broken for mobile users since it requires that extra tap. |
We did consider that approach, but it would require faking the input to look like a button, which likely is a nightmare for accessibility behaviour. I definitely see what you mean with it feeling a little broken, but what we found is the best fix is showing some UI on empty query, either query suggestions or static content, which makes that screen more interactive, and also makes more sense not to immediately cover it up with the keyboard. You can see a similar pattern in many mobile applications (twitter, reddit), where the search button goes to an explore page, which allows people to find that immediately, but also requires two taps to get to the actual search bar. We might reconsider this in the future, but for the time being this resolution makes sense to us. |
@Haroenv could we have a demo of how to work around this problem? 😃 |
Has there been a change? Or is it still this way |
@amirhega the problem isn't solved yet. |
With all due respect to the maintainers' decision, I disagree with this being closed with "wontfix". In our use case, the majority of users are using mobile and the majority of those iOS devices, resulting in a poor user experience for at least half of our users. In fact this is even broken on Algolia's own website.
iOS Safari does allow programmatic However, the code calling I've tried removing For the impatient, I've published my fork on npm: https://www.npmjs.com/package/@salomvary/autocomplete-js |
I believe the Thanks a lot for your contribution already @salomvary |
I just spoke with @francoischalifour and the initial reasoning was to slow down the setters a little so "other work on the page" can happen too. As fixing this bug is clearly more important, we should definitely remove the |
Here we go #1231 |
--------- Co-authored-by: Haroen Viaene <[email protected]>
Thanks again @salomvary , the fix is now part of autocomplete v1.14.0. |
Description
I'm not sure if I used correct terms in the title, but anyway when clicking a search box, it doesn't get focused even in our example:
https://xbnmy.csb.app/
Reproduction
RPReplay_Final1630498486.MP4
Preview →
Steps
Expected behavior
It should've been focused after the first click.
Environment
The text was updated successfully, but these errors were encountered: