Skip to content

Commit

Permalink
fix(core/select): set value before triggering event (#1401)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuke-ellington authored Jul 29, 2024
1 parent 5343eed commit 1b4da95
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fuzzy-countries-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@siemens/ix": patch
---

fix(core/select): set value before triggering event
4 changes: 3 additions & 1 deletion packages/core/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,16 @@ export class Select {
}

private itemClick(newId: string) {
const oldValue = this.value;
const value = this.toggleValue(newId);
this.value = value;
const defaultPrevented = this.emitValueChange(value);

if (defaultPrevented) {
this.value = oldValue;
return;
}

this.value = value;
this.updateSelection();
}

Expand Down

0 comments on commit 1b4da95

Please sign in to comment.