Click on itemBox label focus edits (#5065)

Click on a label of a focused field will refocus itemTree
or the reader content, depending on the tab. That way
focus is not lost.

Fixes: #5063
This commit is contained in:
abaevbog 2025-03-05 02:59:11 -08:00 • committed by GitHub
parent c262a5b392
commit d3cee95fb7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 2 deletions

View file

@ -700,7 +700,7 @@
let labelWrapper = event.target.closest(".meta-label");
if (labelWrapper.nextSibling.contains(document.activeElement)) {
document.activeElement.blur();
ZoteroPane.itemsView.focus();
}
else if (!labelWrapper.nextSibling.firstChild.readOnly) {
labelWrapper.nextSibling.firstChild.focus();

View file

@ -1679,7 +1679,15 @@
let labelWrapper = label.closest(".meta-label");
if (labelWrapper.nextSibling.contains(document.activeElement)) {
document.activeElement.blur();
// click on label when value field is already focused
// will refocus itemTree in library tab or reader content in reader tab
if (Zotero_Tabs.selectedType === "library") {
ZoteroPane.itemsView.focus();
}
else {
let reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID);
reader.focus();
}
}
else {
let valueField = labelWrapper.nextSibling.firstChild;