Skip to content
This repository was archived by the owner on Feb 7, 2026. It is now read-only.
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/assets/javascripts/spree/backend/spree-select2.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ document.addEventListener("spree:load", function() {
placeholder: Spree.translations.select_an_option,
allowClear: true
})

if(jQuery().jquery === '3.6.0') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you describe in more detail what changed in jquery 3.6 so that this if is required?
Also, if applying such a change it would be great to do a broader check e.g. if version is >= 3.6

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rafalcymerys,

This pull request includes a fix for the search box not focusing immediately after the select is opened for clients using latest jquery v3.6.0. Please see the video below for the issue.

Spree-Administration-Products.webm

Note : I have changed the jQuery version check with broader check.

$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus()
});
}
})

$.fn.addSelect2Options = function (data) {
Expand Down