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

Results disappears on keyboard dismissal on iOS #98

Open
NiklasBr opened this issue Jan 3, 2023 · 5 comments
Open

Results disappears on keyboard dismissal on iOS #98

NiklasBr opened this issue Jan 3, 2023 · 5 comments

Comments

@NiklasBr
Copy link

NiklasBr commented Jan 3, 2023

On iOS 16 searching and then dismissing the keyboard to scroll in the results will cause the results to disappear. It would be very good if they stayed

Created because #74 was incorrectly closed.

@denis-taran
Copy link
Owner

denis-taran commented Feb 7, 2023

On IOS, if you close the keyboard, safari will automatically unfocus/blur the textbox and thus the widget will remove all suggestions. Here are some topics on stackoverflow that discuss this issue:

https://stackoverflow.com/questions/27975462/prevent-blur-event-on-keyboard-close
https://stackoverflow.com/questions/5652322/how-to-prevent-a-js-blur-event-in-ios-webkit-when-the-virtual-keyboard-is-dismis

I'm not aware of any good workaround to prevent this, but if you have any suggestions, you can post them here.

@NiklasBr
Copy link
Author

NiklasBr commented Feb 7, 2023

I think it would be a good idea to not remove the DOM on blur, or allow implementations to override the onBlur event which removes the content.

@atomtigerzoo
Copy link

Sadly this is a real deal-breaker for me. If you type a on the demo and then hide the keyboard, the suggestions disappear. If you keep the keyboard, you cannot reach the last entries because these are overlayed/blocked by the keyboard.

@denis-taran
Copy link
Owner

Hi @atomtigerzoo and @NiklasBr

I've developed a fix to address this issue and it should prevent the autocomplete from closing when user is closing virtual keyboard on IOS devices.

Please note that this solution is a bit of a workaround, as it extends the delay before the autocomplete closes following a blur event from 200ms to 800ms. This means that if a user clicks somewhere else on a webpage, the autocomplete widget will remain visible for a longer period than before (but only on IOS devices).

You can install this fix using the following command:

npm install --save-dev kraaden/autocomplete#2cbac7b8e56bf5e1e64bb19318c9e59f16b919c3

@denis-taran
Copy link
Owner

I have addressed the issue of increased delays on iOS devices. The delay should now be consistent at 200ms across different devices. Please update to the latest version by running the following command:

npm install --save-dev kraaden/autocomplete#1fb9967df8f0142678730baba346202c2905746c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants