From 63f52b46836f5a24aeb06630689245999f5c5fec Mon Sep 17 00:00:00 2001 From: metonym Date: Thu, 10 Feb 2022 08:27:09 -0800 Subject: [PATCH] fix(multi-select): non-filterable `MultiSelect` should dispatch a blur event (#1080) The non-filterable `MultiSelect` is missing a `blur` event. Implementation-wise, we have to dispatch it and include the event as the `detail`. Otherwise, the filterable variant will dispatch "blur" twice because it has both a button and input. The filterable `MultiSelect` continues to forward the blur event to the input. --- COMPONENT_INDEX.md | 2 +- docs/src/COMPONENT_API.json | 8 ++++++-- package.json | 2 +- src/MultiSelect/MultiSelect.svelte | 7 +++++++ tests/MultiSelect.test.svelte | 3 +++ types/MultiSelect/MultiSelect.svelte.d.ts | 2 +- yarn.lock | 8 ++++---- 7 files changed, 23 insertions(+), 9 deletions(-) diff --git a/COMPONENT_INDEX.md b/COMPONENT_INDEX.md index a34b1d40..4b732219 100644 --- a/COMPONENT_INDEX.md +++ b/COMPONENT_INDEX.md @@ -2461,12 +2461,12 @@ None. | Event name | Type | Detail | | :--------- | :--------- | :------------------------------------------------------------------------------------------------------------- | +| blur | dispatched | FocusEvent | CustomEvent | | select | dispatched | { selectedIds: MultiSelectItemId[]; selected: MultiSelectItem[]; unselected: MultiSelectItem[]; } | | clear | dispatched | any | | keydown | forwarded | -- | | keyup | forwarded | -- | | focus | forwarded | -- | -| blur | forwarded | -- | ## `NotificationActionButton` diff --git a/docs/src/COMPONENT_API.json b/docs/src/COMPONENT_API.json index 0472a252..2c1a7b6a 100644 --- a/docs/src/COMPONENT_API.json +++ b/docs/src/COMPONENT_API.json @@ -6776,6 +6776,11 @@ ], "slots": [], "events": [ + { + "type": "dispatched", + "name": "blur", + "detail": "FocusEvent | CustomEvent" + }, { "type": "dispatched", "name": "select", @@ -6784,8 +6789,7 @@ { "type": "dispatched", "name": "clear", "detail": "any" }, { "type": "forwarded", "name": "keydown", "element": "input" }, { "type": "forwarded", "name": "keyup", "element": "input" }, - { "type": "forwarded", "name": "focus", "element": "input" }, - { "type": "forwarded", "name": "blur", "element": "input" } + { "type": "forwarded", "name": "focus", "element": "input" } ], "typedefs": [ { diff --git a/package.json b/package.json index 52a519bc..e7609c78 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "rollup-plugin-svelte": "^7.1.0", "rollup-plugin-terser": "^7.0.2", "sass": "^1.42.1", - "sveld": "^0.13.1", + "sveld": "^0.13.2", "svelte": "^3.45.0", "svelte-check": "^1.1.32", "typescript": "^4.1.3" diff --git a/src/MultiSelect/MultiSelect.svelte b/src/MultiSelect/MultiSelect.svelte index c90fdeda..0d6130af 100644 --- a/src/MultiSelect/MultiSelect.svelte +++ b/src/MultiSelect/MultiSelect.svelte @@ -1,4 +1,8 @@