citation dlg: no input refocus on Enter from popup (#5159)

Remove refocusing of the input on Enter from item details
popup - just let focus go back to the bubble.
Input refocusing was initially added with the idea that once
you make some edits and confirm them with Enter,
you are ready to go back to typing in the search input.
But then, Enter on Done or Cancel is treated as equivalent
to click, so the focus goes back to the bubble. When
the dialog is cancelled via Escape, focus lands
on the bubble as well, in case you need to keep going to
locate the another item to customize.

This different focus behavior on Enter is indeed a bit
inconsistent and likely no longer needed, now that
you can always refocus input with Cmd/Ctrl+F.

https://forums.zotero.org/discussion/122823/some-advice-for-citation-dialog-in-beta
This commit is contained in:
abaevbog 2025-03-24 21:04:13 -07:00 • committed by GitHub
parent 6787dcd596
commit cf37bf5ce1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 1 additions and 8 deletions

View file

@ -1398,12 +1398,6 @@ const IOManager = {
let popup = event.target;
if (!["xul:panel"].includes(popup.tagName)) return;
IOManager._noRefocusing = false;
// after item details popup closes on Enter, refocus the last input
if (popup.id == "itemDetails" && popup.getAttribute("refocus-input")) {
_id("bubble-input").refocusInput();
popup.removeAttribute("refocus-input");
return;
}
if (IOManager._focusBeforePanelShow) {
IOManager._focusBeforePanelShow.focus();
}

View file

@ -183,9 +183,8 @@ export class CitationDialogPopupsHandler {
}
handleItemDetailsKeypress(event) {
// Enter on a an input will save changes, hide the popup and refocus last input
// Enter on a an input will save changes and hide the popup
if (event.key == "Enter" && ["input"].includes(event.target.tagName) && !event.target.getAttribute("type")) {
this._getNode("#itemDetails").setAttribute("refocus-input", true);
this._getNode("#itemDetails").hidePopup();
}
}