autocomplete icon indicating copy to clipboard operation
autocomplete copied to clipboard

Detached Mode History selection scrolls down to the bottom on iOS devices

Open deresatom opened this issue 4 years ago • 15 comments

Description

This one might be related to #591 because it tries to scroll into a miscalculated position? Not sure about that though.

By selecting a element from the History section on the detached panel (createLocalStorageRecentSearchesPlugin) it will scroll to the bottom of the page on some iOS devices.

iOS 14.5.1 seems to be having this issue, older versions like 14.4 worked for some of my users, but it scrolled down for others.

It works perfectly on:

  • Android devices
  • Windows 10
  • Safari desktop

Note: it also works by selecting an autocomplete value which is NOT from the history. So only the History plugin bugs it somehow.

Reproduction

Steps

  1. Go to codesandbox on an iOS device
  2. Open search input
  3. select an item from History

https://user-images.githubusercontent.com/21248854/119544895-7920ce00-bd92-11eb-8b64-28a5c980adfa.mp4

Video shows: starting: top of the screen, after clicking the history value, it jumps down to the bottom.

Expected behavior

Keep the current state and don't scroll down.

Environment

  • OS: iOS 14.5.1 / multiple iOS devices
  • Browser: Safari / Chrome
  • Autocomplete version: 1.0.1

Update: new codesandbox for easier debugging

deresatom avatar May 24 '21 15:05 deresatom

I'm also having this issue, what is the current recommended fix?

darylsew avatar Jul 11 '23 12:07 darylsew

Hi @darylsew,

I can't seem to reproduce it on iOS 16.5.1, which version are you using ?

aymeric-giraudet avatar Jul 27 '23 15:07 aymeric-giraudet

iOS 16.5.1 - happens on my iphone and all my users iphones. Does not happen on the emulator, needs to be on physical device. Happens in all browsers with detached mode. You're testing on the physical device with this version? this is how I'm importing the library:

<script src="//cdn.jsdelivr.net/g/algoliasearch,algoliasearch.helper"></script>
<script src="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-js"></script>
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-theme-classic"
/>

darylsew avatar Aug 01 '23 17:08 darylsew

I was just able to trigger it in the sandbox link above on my ios device. You have to try searching a few times, it doesn't always trigger. It's not even necessarily related to history, it just happens when clicking on any autocomplete dropdown items. It does seem to happen everytime when I click on the history items though.

darylsew avatar Aug 01 '23 18:08 darylsew

Hi @darylsew ,

It does happen for me on the CodeSandbox preview on my iPhone 13 but does not on https://kd7bg.csb.app/

I'll check tomorrow if it does on localhost, in the meantime can you confirm it doesn't work on the link above ?

aymeric-giraudet avatar Aug 01 '23 19:08 aymeric-giraudet

On your new link it doesn't repro. How can I get my codebase to update to that version?

darylsew avatar Aug 01 '23 20:08 darylsew

Wanted to follow up on this

darylsew avatar Aug 04 '23 19:08 darylsew

The code for that sandbox is here: http://codesandbox.io/s/kd7bg

Haroenv avatar Aug 07 '23 07:08 Haroenv

What do I do if I'm not using tsx? I have a vanilla js setup

darylsew avatar Aug 08 '23 07:08 darylsew

that doesn't change anything, you can strip out the typescript parts @darylsew

Haroenv avatar Aug 08 '23 08:08 Haroenv

    <script src="env.ts"></script>
    <script src="app.tsx"></script>

I don't see how I would include these files? Including them just gives me an error.

Is there a way to get the following import style to work:

<script src="//cdn.jsdelivr.net/g/algoliasearch,algoliasearch.helper"></script>
<script src="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-js"></script>
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-theme-classic"
/>

darylsew avatar Aug 08 '23 08:08 darylsew

Anyhow I tweaked my imports to import a later version so the import versions match up with the sandbox. Unfortunately the issue is still occurring.

<script src="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-js"></script>
<script
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/algoliasearch.umd.js"
  integrity="sha256-kQlgGuOm0EkEyVLxfQslmOI9ncN5cjv4aqyFLLphuRk="
  crossorigin="anonymous"
></script>
<link
  rel="stylesheet"
  href="https://cdn.jsdelivr.net/npm/@algolia/autocomplete-theme-classic"
/>

I played around with the sandbox you provided. So I'm unable to reproduce the issue on the deployed site at https://kd7bg.csb.app/ however, if i click "open sandbox" on that site, and then use the app within the sandbox html code, I can reproduce it. I'm not sure why that is, but I think that means the issue is not fixed. Please try it.

IMG_0591

darylsew avatar Aug 10 '23 20:08 darylsew

https://github.com/algolia/autocomplete/assets/975269/ba8502b4-4476-407c-acbd-f6cf3e1a49cc

darylsew avatar Aug 10 '23 20:08 darylsew

fwiw i was able to repro on the algolia docs too - see attached is there a quick workaround?

https://github.com/algolia/autocomplete/assets/975269/f375aac1-d58b-47ea-b7fd-cc50ed7a6f55

darylsew avatar Aug 10 '23 22:08 darylsew

bump

darylsew avatar Apr 04 '24 22:04 darylsew