mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-10 03:28:18 +01:00
back port fix from issue #24429
This commit is contained in:
@@ -1302,14 +1302,14 @@ $(document).ready(function() {
|
|||||||
<?php
|
<?php
|
||||||
if (empty($conf->global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) {
|
if (empty($conf->global->MAIN_DISABLE_SELECT2_FOCUS_PROTECTION) && !defined('DISABLE_SELECT2_FOCUS_PROTECTION')) {
|
||||||
?>
|
?>
|
||||||
$(document).on('select2:open', () => {
|
$(document).on('select2:open', (e) => {
|
||||||
console.log("Execute the focus (click on combo or use space when on component");
|
console.log("Execute the focus (click on combo or use space when on component");
|
||||||
let allFound = document.querySelectorAll('.select2-container--open .select2-search__field');
|
const target = $(e.target);
|
||||||
$(this).one('mouseup keyup',()=>{
|
if (target && target.length) {
|
||||||
setTimeout(()=>{
|
let id = target[0].id || target[0].name;
|
||||||
allFound[allFound.length - 1].focus();
|
if (id.substr(-2) == "[]") id = id.substr(0,id.length-2);
|
||||||
},0);
|
document.querySelector('input[aria-controls*='+id+']').focus();
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user