focus search field on Ctrl-F in manager (#935)
This commit is contained in:
parent
367d1672c5
commit
379c825408
|
@ -73,18 +73,22 @@ onDOMready().then(() => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function maybeRefocus(event) {
|
function maybeRefocus(event) {
|
||||||
if (event.altKey || event.ctrlKey || event.metaKey ||
|
if (event.altKey || event.metaKey || $('#message-box')) {
|
||||||
event.target.matches('[type="text"], [type="search"], [type="number"]') ||
|
|
||||||
$('#message-box')) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
const inTextInput = event.target.matches('[type=text], [type=search], [type=number]');
|
||||||
const {which: k, key} = event;
|
const {which: k, key} = event;
|
||||||
// focus search field on "/" key
|
// focus search field on "/" or Ctrl-F key
|
||||||
if (key === '/' || !key && k === 191 && !event.shiftKey) {
|
if (event.ctrlKey
|
||||||
|
? (event.code === 'KeyF' || !event.code && k === 70) && !event.shiftKey
|
||||||
|
: (key === '/' || !key && k === 191 && !event.shiftKey) && !inTextInput) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
$('#search').focus();
|
$('#search').focus();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (event.ctrlKey || inTextInput) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const time = performance.now();
|
const time = performance.now();
|
||||||
if (
|
if (
|
||||||
// 0-9
|
// 0-9
|
||||||
|
|
Loading…
Reference in New Issue
Block a user