win: no collection highlight if input is focused

So that collections do not randomly get highlighted when one clicks
Ctrl-C/Ctrl-V to copy-paste something in the itemPane
This commit is contained in:
Bogdan Abaev 2024-02-02 15:14:12 -05:00 committed by Dan Stillman
parent 579106c3af
commit fc5aa1a6ba

View file

@ -1048,7 +1048,10 @@ var ZoteroPane = new function()
//
// We use Control (17) on Windows because Alt triggers the menubar;
// otherwise we use Alt/Option (18)
if ((Zotero.isWin && event.keyCode == 17 && !event.altKey) ||
// On windows, do not highlight when an input is focused to not interfere with
// Ctrl-C/Ctrl-V copy-paste shortcuts
let inputFocused = ["input", "textarea"].includes(document.activeElement.tagName);
if ((Zotero.isWin && event.keyCode == 17 && !event.altKey && !inputFocused) ||
(!Zotero.isWin && event.keyCode == 18 && !event.ctrlKey)
&& !event.shiftKey && !event.metaKey) {
// On windows, the event is re-triggered multiple times