JaleelB / emblor

A fully-featured tag input component built with shadcn/ui
https://emblor.jaleelbennett.com
MIT License
676 stars 31 forks source link

[bug]: Autocomplete broken (even in docs demo) - popover does not appear while typing #78

Closed lucasdellabella closed 1 month ago

lucasdellabella commented 2 months ago

Describe the bug

I expect the autocomplete popover to appear as soon as I start typing, but it doesn't. I'm on latest (1.4.4). failure is created by minimal reproduction with only required props enableAutocomplete={true} and autocomplete options like so

  const autocompleteOptions = [
    { id: "1", text: "outdoor" },
    { id: "2", text: "indoor" },
    { id: "3", text: "level 1" },
    { id: "4", text: "level 2" },
    { id: "5", text: "east" },
    { id: "6", text: "south" },
    { id: "7", text: "west" },
    { id: "8", text: "north" },
  ];

How to reproduce

Check the demo example, the autocomplete popup does not appear. https://emblor.jaleelbennett.com/api-reference

Link to reproduction

https://github.com/JaleelB/emblor

Additional information

No response

JaleelB commented 2 months ago

@lucasdellabella Did you by any chance hit the popover trigger dropdown?

https://github.com/user-attachments/assets/9e65ed20-531b-495a-b96d-64b5fd80ebaf

I probably should have the drop-down appear on input focus but that isn't a bug. That does sound like a good UX detail to implement so create a feature request and I'll add it in

lucasdellabella commented 2 months ago

@JaleelB Yeah, autocomplete is a bit funky so thought there was just some bigger general issue (e.g. if i already have typed into the input field, and then try to open the popup, the popup is broken). Can make a feature request, i already forked, may be able to make the change myself in which case I'll open a PR.

Do you want it just as a boolean setting, "openAutocompletePopoverOnFocus?: boolean"?

JaleelB commented 2 months ago

@JaleelB Yeah, autocomplete is a bit funky so thought there was just some bigger general issue (e.g. if i already have typed into the input field, and then try to open the popup, the popup is broken). Can make a feature request, i already forked, may be able to make the change myself in which case I'll open a PR.

Do you want it just as a boolean setting, "openAutocompletePopoverOnFocus?: boolean"?

Make it the default functionality. It makes sense for it to be that way. A prop just complicates that

JaleelB commented 1 month ago

https://github.com/user-attachments/assets/bfc40884-9785-42e7-b4fc-f2acc33b5de2

The changes discussed have been implemented in the latest version of the package