Downgrade jQuery to 3.5.1 from 3.6.0 to re-enable select2 autofocus #11157
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: requires npm install/asset rebuild
Fixes [sc-19093]. This is actually a select2+jQuery 3.6.0 bug, as documented here: select2/select2#5993
There are several different workarounds, some that are different in a Bootstrap Modal context, and some elsewhere (we need both) - but they junk up the code and they didn't work very consistently for me - and I tried many, if not all, of them.
Instead what I went with was downgrading jQuery to 3.5.1. I was concerned that the previous version of jQuery might have some security vulnerabilities, but I didn't see anything here: https://snyk.io/vuln/npm:jquery@3.5.1 nor elsewhere, so I think we may be okay?
Once a newer version of Select2 is released (there is a v4.1 that is in beta), we may be able to upgrade both packages and have the autofocus still work - but it doesn't necessarily seem like that based on what I'm seeing in the Select2 repository right now.