Fix inconsistent ESC behavior on text edit when reader is opened (#3417)
This is needed to let itemBox, tagBox, etc. to handle ESC events to revent any edits made to textfields. Only applied if the currently focused element is input or textarea. Fixes: #3246
This commit is contained in:
parent
9d710ea135
commit
436b19d64c
1 changed files with 6 additions and 2 deletions
|
@ -843,8 +843,12 @@ var ZoteroPane = new function()
|
|||
let reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
|
||||
if (reader) {
|
||||
reader.focus();
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
// Keep propagating if current focus is on input or textarea
|
||||
// The Escape event needs to be handled by itemBox, tagBox, etc. to undo edits.
|
||||
if (!["input", "textarea"].includes(document.activeElement.tagName)) {
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue