Skip to content

Commit

Permalink
fix(dropdown): emits blur after change event
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed Aug 26, 2024
1 parent a7f0d46 commit f0aa446
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 f0aa446

Please sign in to comment.