Skip to content

[Bug]: Autocomplete doesn't allow changing selection #624

@Razzmatazzz

Description

@Razzmatazzz

Before submitting...

Context

I would like to be able to use the Autocomplete component but allow the user to select a different option after initially selecting an item.

Current Behavior

When you select an item using the autocomplete, it doesn't let you change your selection. You can try deleting the text shown or typing in something different, but your changes are undone.

Expected behavior

I would expect that a user isn't forced to use their first selection and should be free to search for and select other options.

Possible Solutions or Causes

I think it's because the autocomplete.options.data value gets overwritten when menu items are selected:

this.options.data = menuItems;

Steps to reproduce

This behavior is demonstrated even with the example Autocomplete control in the docs:
https://materializeweb.com/autocomplete.html

Click in the autocomplete box, select an option, and then try selecting a different option.

Your Environment

  • Version used: 2.2.2
  • Browser Name and version: Firefox 138.0.3
  • Operating System and version (desktop or mobile): Windows 11
  • Additional information you want to tell us:

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions