Skip to content

Commit

Permalink
Merge pull request #541 from wpmudev/fix/SUI-562
Browse files Browse the repository at this point in the history
🐛 fix(multi select): select2 multi select disappearing issue.
  • Loading branch information
rtbfreitas authored Jun 20, 2023
2 parents 59e6798 + 2f61544 commit 3ba3edf
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions assets/js/shared-ui/select2.full.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 3ba3edf

Please sign in to comment.