From b51978b1a6e20e1b23f50efb136251ba6010be9e Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Fri, 4 Sep 2020 08:02:39 -0400 Subject: [PATCH] Fix duplicate slBlur/slFocus in select; closes #200 --- CHANGELOG.md | 1 + src/components/select/select.tsx | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9c4c3f94..1358c2498 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - Fixed a bug where swapping an animated element wouldn't restart the animation in `sl-animation` - Fixed a bug where the cursor was incorrect when `sl-select` was disabled +- Fixed a bug where `slBlur` and `slFocus` were emitted twice in `sl-select` - Fixed a bug where clicking on `sl-menu` wouldn't focus it - Improved keyboard logic in `sl-dropdown`, `sl-menu`, and `sl-select` - Updated `sl-animation` to stable diff --git a/src/components/select/select.tsx b/src/components/select/select.tsx index 61343ef09..ba272ba7a 100644 --- a/src/components/select/select.tsx +++ b/src/components/select/select.tsx @@ -162,12 +162,14 @@ export class Select { return Array.isArray(this.value) ? this.value : [this.value]; } - handleBlur() { + handleBlur(event: CustomEvent) { + event.stopPropagation(); this.hasFocus = false; this.slBlur.emit(); } - handleFocus() { + handleFocus(event: CustomEvent) { + event.stopPropagation(); this.hasFocus = true; this.slFocus.emit(); this.input.setSelectionRange(0, 0);