Set focus tp Global Search form if user presses Ctrl-F (#14947)

This commit is contained in:
Stef
2023-04-07 20:05:39 +02:00
committed by GitHub
parent 4465de874d
commit 74c627270a

View File

@@ -760,4 +760,22 @@
});
}
@endif
$(document).ready(function(){
// Function to focus Global Search on Ctrl-F
window.addEventListener("keydown",function (e) {
if (e.keyCode === 114 || (e.ctrlKey && e.keyCode === 70)){
if($('#gsearch').is(":focus")) {
//allow normal Ctrl-F on a 2nd Hit
return true;
} else {
//set Focus on Global Search and ignore Browsers defaults
e.preventDefault();
$('#gsearch').focus();
}
}
})
})
</script>