Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: back port fix from issue #24429 #25891

Merged
merged 1 commit into from Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions htdocs/core/js/lib_head.js.php
Expand Up @@ -1302,14 +1302,14 @@ function price2numjs(amount) {
<?php
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");
let allFound = document.querySelectorAll('.select2-container--open .select2-search__field');
$(this).one('mouseup keyup',()=>{
setTimeout(()=>{
allFound[allFound.length - 1].focus();
},0);
});
const target = $(e.target);
if (target && target.length) {
let id = target[0].id || target[0].name;
if (id.substr(-2) == "[]") id = id.substr(0,id.length-2);
document.querySelector('input[aria-controls*='+id+']').focus();
}
});
<?php
}
Expand Down