From f0aa446007978c94369bcf7943ac782def8abb1b Mon Sep 17 00:00:00 2001 From: Gery Hirschfeld Date: Mon, 26 Aug 2024 13:13:45 +0200 Subject: [PATCH] fix(dropdown): emits blur after change event --- .changeset/silver-pears-fail.md | 5 +++++ packages/core/src/utils/dropdown/option.tsx | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 .changeset/silver-pears-fail.md diff --git a/.changeset/silver-pears-fail.md b/.changeset/silver-pears-fail.md new file mode 100644 index 0000000000..030309c6af --- /dev/null +++ b/.changeset/silver-pears-fail.md @@ -0,0 +1,5 @@ +--- +'@baloise/ds-core': patch +--- + +**dropdown**: emits blur after change event diff --git a/packages/core/src/utils/dropdown/option.tsx b/packages/core/src/utils/dropdown/option.tsx index 99433a3c74..6d8e8ec85c 100644 --- a/packages/core/src/utils/dropdown/option.tsx +++ b/packages/core/src/utils/dropdown/option.tsx @@ -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 })) + } } } }