Skip to content

Change event is triggered twice #1730

@tim-vandecasteele

Description

@tim-vandecasteele

What component (if applicable)

Describe the bug
I want to submit a form on change after the autocomplete is selected, but because the event is triggered twice (once on blur because you click away, and once on the input event triggered by Tailwind elements), it seems impossible to do so.

To Reproduce
Steps to reproduce the behavior:

  1. Add an onChange event to the input of the autocomplete
  2. Type something so the autocomplete menu expands
  3. Click an item in the autocomplete list
  4. See the change event is triggered twice

Expected behavior
You can't eliminate this behaviour, but I wondered if there could be specific tailwind element events you could listen on, or a way to distinguish the change event from tailwind with the change event from the input itself.

Browser/Device (if applicable)

  • OS: macOS
  • Browser chrome & safari

Additional context
I couldn't find anything in the documentation about events except for the 'elements:ready' event. So I don't know what the stance is on events. But it seems like it would be make the elements more flexible if their would be more events or if there would be more info in the events.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions