Skip to content

Commit

Permalink
🐛 fix(dropdown): emits blur after change event (#1439)
Browse files Browse the repository at this point in the history
fix(dropdown): emits blur after change event
  • Loading branch information
hirsch88 committed Sep 5, 2024
1 parent a3df225 commit 56149e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/silver-pears-fail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@baloise/ds-core': patch
---

**dropdown**: emits blur after change event
5 changes: 4 additions & 1 deletion packages/core/src/utils/dropdown/option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,14 @@ export class DropdownOptionUtil {
await this.component.valueUtil.updateInputContent()
}

async listenToOptionChange(_ev: BalEvents.BalOptionChange) {
async listenToOptionChange(ev: BalEvents.BalOptionChange) {
const newSelectedValues = (await this.component.listEl?.getSelectedValues()) || []
this.component.valueUtil.updateRawValueBySelection(newSelectedValues)
if (!this.component.multiple) {
this.component.popupUtil.collapseList()
if (this.component.hasFocus) {
this.component.balBlur.emit(new FocusEvent('blur', { relatedTarget: this.component.el }))
}
}
}
}

0 comments on commit 56149e2

Please sign in to comment.