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

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

Open
deresatom opened this issue May 24, 2021 · 15 comments
Open

Comments

@deresatom
Copy link

deresatom commented May 24, 2021

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
scrollbug.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

@darylsew
Copy link

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

@aymeric-giraudet
Copy link
Member

Hi @darylsew,

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

@darylsew
Copy link

darylsew commented Aug 1, 2023

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
Copy link

darylsew commented Aug 1, 2023

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.

@aymeric-giraudet
Copy link
Member

aymeric-giraudet commented Aug 1, 2023

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 ?

@darylsew
Copy link

darylsew commented Aug 1, 2023

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

@darylsew
Copy link

darylsew commented Aug 4, 2023

Wanted to follow up on this

@Haroenv
Copy link
Contributor

Haroenv commented Aug 7, 2023

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

@darylsew
Copy link

darylsew commented Aug 8, 2023

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

@Haroenv
Copy link
Contributor

Haroenv commented Aug 8, 2023

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

@darylsew
Copy link

darylsew commented Aug 8, 2023

    <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
Copy link

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_no="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
Copy link

repro_in_sandbox.mov

@darylsew
Copy link

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

repro_on_algolia_site.mov

@darylsew
Copy link

darylsew commented Apr 4, 2024

bump

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

No branches or pull requests

6 participants