Focus sur la recherche libre à l'ouverture du select en SPIP4
Salut,
il y a un changement de comportement entre SPIP 3.2 et SPIP 4 quand on ouvre le select : en SPIP 3.2, le champ de recherche libre prend le focus, mais pas en SPIP4.
En fouillant, ça semble en lien avec jQuery 3.6 :
Et le fix à ajouter pour rétablir le fonctionnement (trouvé ici) :
/*
* Hacky fix for a bug in select2 with jQuery 3.6.0's new nested-focus "protection"
* see: https://github.com/select2/select2/issues/5993
* see: https://github.com/jquery/jquery/issues/4382
*
* TODO: Recheck with the select2 GH issue and remove once this is fixed on their side
*/
$(document).on('select2:open', () => {
document.querySelector('.select2-search__field').focus();
});