From 2f6154486c610908fa7e2ebfd67101b448e67e8e Mon Sep 17 00:00:00 2001 From: Pawan Kumar Date: Wed, 26 Apr 2023 17:30:28 +0530 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(multiselect):=20select2=20mu?= =?UTF-8?q?ltiselect=20disappearing=20issue.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/shared-ui/select2.full.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assets/js/shared-ui/select2.full.js b/assets/js/shared-ui/select2.full.js index 9ed984b48..78c3ef949 100644 --- a/assets/js/shared-ui/select2.full.js +++ b/assets/js/shared-ui/select2.full.js @@ -5842,7 +5842,8 @@ this.on('keypress', function (evt) { var key = evt.which; - + var isMultiSelect = this.$element[0].hasAttribute('multiple'); + if (self.isOpen()) { if (key === KEYS.ENTER) { self.trigger('results:select'); @@ -5860,7 +5861,7 @@ self.close(); evt.preventDefault(); } - } else { + } else if ( ! isMultiSelect ) { // Added the functionality to change option on press of up and down arrow. @edited if (key === KEYS.ENTER || key === KEYS.SPACE || ((key === KEYS.DOWN || key === KEYS.UP) && evt.altKey)) { self.open(); @@ -5891,7 +5892,6 @@ let elemVal = selectedValue; values.each(function(index) { - console.log(selectedValue); if(selectedValue !== '' && selectedValue[0].toLowerCase() === keyPressed) { if ($(this).text() === selectedValue && index !== arrLength) { elemVal = $(values[index + 1]).val();