From 310577c49d8a5ec9914c96807f898e233300792a Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Wed, 10 May 2023 12:49:11 +0100 Subject: [PATCH] Close dropdown after selection with multiselect This conforms with the previous select2 multiselect behaviour --- app/webpacker/controllers/tom_select_controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/webpacker/controllers/tom_select_controller.js b/app/webpacker/controllers/tom_select_controller.js index ebf163d129..9cf4401fe6 100644 --- a/app/webpacker/controllers/tom_select_controller.js +++ b/app/webpacker/controllers/tom_select_controller.js @@ -8,6 +8,7 @@ export default class extends Controller { maxOptions: null, plugins: ["dropdown_input"], allowEmptyOption: true, + closeAfterSelect: true, onItemAdd: function () { this.setTextboxValue(""); }, @@ -34,7 +35,6 @@ export default class extends Controller { #placeholder() { const optionsArray = [...this.element.options]; - return optionsArray.find((option) => [null, ""].includes(option.value)) - ?.text; + return optionsArray.find((option) => [null, ""].includes(option.value))?.text; } }