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

[BUG] - Unexpected behaviour on autocompleteItem select #3449

Open
Mike3386 opened this issue Jul 11, 2024 · 11 comments · May be fixed by #3732
Open

[BUG] - Unexpected behaviour on autocompleteItem select #3449

Mike3386 opened this issue Jul 11, 2024 · 11 comments · May be fixed by #3732
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working

Comments

@Mike3386
Copy link

Mike3386 commented Jul 11, 2024

NextUI Version

2.4.2

Describe the bug

On mobile, when you tap on AutocompleteItem and there is other autocomplete under it, it makes element under focused.

Your Example Website or App

CodeSandbox

Steps to Reproduce the Bug or Issue

  1. Open codesandbox
  2. Open preview in new tab
  3. Open devTools
  4. Toggle device toolbar
  5. Open first autocomplete
  6. Tap on autoCompleteItem that has autocomplete under it
  7. See bug

Expected behavior

As a user, i expected to close list of autoCompleteItems and element under might be not focused

Screenshots or Videos

Display how it looks

Vite.App.-.Google.Chrome.-.11.July.2024.mp4

Operating System Version

Windows

Browser

Chrome

Copy link

linear bot commented Jul 11, 2024

@navneetthakor
Copy link

Hello @wingkwong can you please assing this issue to me

@navneetthakor
Copy link

@wingkwong I have tried to discover issue well but nothing is happening as you mentioned here.

Uploading Untitled video - Made with Clipchamp.mp4…

@wingkwong
Copy link
Member

@navneetthakor I just tested on the given sandbox again and i can reproduce the issue. you need to do it in mobile viewport. Also the video you provided is now shown. please double check.

@jhargett
Copy link

I am also experiencing this issue but only on mobile viewport

@mkrystkowicz
Copy link

Happens on modal as well, for example when you click on close button or outside modal

@jedi04
Copy link

jedi04 commented Sep 6, 2024

I am also facing this issue. Any fix for this?

@wingkwong
Copy link
Member

@navneetthakor any update?

@mkrystkowicz
Copy link

I have switched to react-select package not to confuse mobile users (recommend this approach, less effort than trying to fix that), tried preventing mouse touch but the bug was still there.

@slimshreydy
Copy link

Running into a similar issue. If I have multiple Autocompletes, the first one works as expected but then with the second one, the search value (the value of the input in the autocomplete) gets reset automatically after 2 characters are typed. I only see this issue on Chrome iOS.

@macci001
Copy link
Contributor

Seems like this issue occurs due to the chromium bug. Due to this, the problem got propagated to react-aria's usePress and NextUI library.

Issue Summary:

  • When there is a touchStart event triggered on element and that element moves out of the DOM immediately, the element beneath will get the click event triggered.
  • Due to the this, it will feel like the element beneath the overlay is getting clicked, when overlay is clicked. (This happens only during touch.)

The ReactSpectrum team has already put up the fix for this in usePress: Fix for onClick triggered on wrong target.
This fix is already included in v2.22.3 of RA interactions
We are currently using the the v2.21.3 of RA interactions and using the latest version of the dependency should solve the problem.

Note:

  • Since the issue occurs when the element moves out of the DOM immediately, if there is some delay in its exit, we would not see this issue.
  • An example of above can be seen after 3845 pr was added to the canary. This PR added fixed the exit animation of the pop-over in the autocomplete. Since this avoids the immediate exit of the target, after this PR the issue seems only to persist in case of disabled-animation.

Some of the references:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants