nextui-org / nextui

🚀 Beautiful, fast and modern React UI library.
https://nextui.org
MIT License
22.18k stars 1.56k forks source link

[BUG] - Clearing the autocomplete keeps the popover closed #3924

Open dragos99 opened 1 month ago

dragos99 commented 1 month ago

NextUI Version

@nextui-org/autocomplete@2.1.7

Describe the bug

Once I select an option in the Autocomplete, then I proceed to clear the input using the clear button, then I start typing but the popover with options won't appear anymore.

Your Example Website or App

https://nextui.org/docs/components/autocomplete

Steps to Reproduce the Bug or Issue

  1. Use any autocomplete example from your docs
  2. Type cat and select it
  3. Clear the input with the clear button
  4. Type dog

Expected behavior

The popover with the option "dog" should appear

Screenshots or Videos

No response

Operating System Version

Windows

Browser

Chrome

linear[bot] commented 1 month ago

ENG-1481 [BUG] - Clearing the autocomplete keeps the popover closed

sanuj21 commented 1 month ago

I can't reproduce on Chrome (Linux Mint). Is there any specific prop that needs to be passed?

wingkwong commented 1 month ago

I can reproduce the issue with the above given steps in documentation page.

0xAmansol commented 1 month ago

It sounds like the issue you're encountering with the Autocomplete component is related to the state management of the input and the visibility of the suggestion popover after clearing the input. Can you assign this issue to me? , will be happy to work on this. @wingkwong

wingkwong commented 1 month ago

@0xAmansol go ahead.

karthik-nair-20 commented 1 month ago

In Document I can see this concern, but when I started to work on this in local, it was working fine.

https://github.com/user-attachments/assets/cb561bfb-a038-4aeb-98c7-7eebeeaa65c7

dragos99 commented 1 month ago

Hey, is it perhaps because you're clicking outside? I get the same behavior locally (not working)

0xAmansol commented 1 month ago

Hey, I have imported the component and it does not work. http://surl.li/hptzqz here is the sandbox link you can try checking out here, however i have done some changes in the component source file , but for right now i am unable to test it as i am running into some error while opening the components page locally, i have tried changing EOL of the component file from CRLF to LF but it didnt work, @wingkwong can you suggest a resolution here?

However, in storybooks it seems to work fine, not sure why.

leeeshu commented 1 month ago

Having the same issue. It's also happening in the NextUI doc. If you search -> select -> clear -> [don't click anywhere] -> type again -> the popover doesn't show up.

https://github.com/user-attachments/assets/930555a1-4a5d-495c-bc95-c9b58183aae1