From ccf481c97b03733840f2730573672f5a7eb58c27 Mon Sep 17 00:00:00 2001 From: roykho Date: Wed, 1 Sep 2021 11:41:01 -0700 Subject: [PATCH] Fix search input not getting focus when select2 dropdown element gets focused closes #30607 --- assets/js/selectWoo/selectWoo.full.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/js/selectWoo/selectWoo.full.js b/assets/js/selectWoo/selectWoo.full.js index 5afd78790fc..c2ffb122aee 100644 --- a/assets/js/selectWoo/selectWoo.full.js +++ b/assets/js/selectWoo/selectWoo.full.js @@ -1088,6 +1088,12 @@ S2.define('select2/results',[ self.setClasses(); self.ensureHighlightVisible(); + + // NOTE: DOM's version of the object and not jQuery. + var searchField = self.$results.parents( '.select2-container' ).find( 'input.select2-search__field' )[0]; + if ( 'undefined' !== typeof searchField ) { + searchField.focus(); + } }); container.on('close', function () {