Skip to content

Commit

Permalink
fix(Autocomplete) allow select/deselect from options, overwritten in …
Browse files Browse the repository at this point in the history
…previous commit materializecss#479
  • Loading branch information
gselderslaghs committed Jan 4, 2025
1 parent 507ece8 commit adb4304
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/autocomplete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,13 @@ export class Autocomplete extends Component<AutocompleteOptions> {
if (!li) return;*/
if (this.options.isMultiSelect) {
/* const checkbox = <HTMLInputElement | null>li.querySelector('input[type="checkbox"]');
checkbox.checked = !checkbox.checked;
if (checkbox.checked) this.selectedValues.push(entry);
else
this.selectedValues = this.selectedValues.filter(
(selectedEntry) => selectedEntry.id !== entry.id
);*/
this.selectedValues.push(entry);
checkbox.checked = !checkbox.checked;*/
if (!(this.selectedValues.filter(
(selectedEntry) => selectedEntry.id === entry.id
).length >= 1)) this.selectedValues.push(entry);
else this.selectedValues = this.selectedValues.filter(
(selectedEntry) => selectedEntry.id !== entry.id
);
this._renderDropdown();
this.el.focus();
} else {
Expand Down

0 comments on commit adb4304

Please sign in to comment.