fix some buttons not opening on space/Enter (#4243)

E.g., field-version button in itembox merge mode
This commit is contained in:
Bogdan Abaev 2024-07-02 11:18:54 -07:00 committed by Dan Stillman
parent 8f9d5e190e
commit 80b5486991

View file

@ -1056,12 +1056,12 @@ var ZoteroPane = new function()
if ([" ", "Enter"].includes(event.key)
&& (["button", "toolbarbutton"].includes(tgt.tagName)
|| tgt.classList.contains("keyboard-clickable"))) {
if (event.target.querySelector("menupopup")) {
event.target.click();
// Some menus have a history of not opening on programmatic click
// If event.target.click above worked, this will be a noop.
if (event.target.menupopup) {
event.target.open = true;
}
else {
event.target.click();
}
event.preventDefault();
event.stopPropagation();
return;