fix itembox field-version button remaining visible (#4243)
Even after the merge mode is no longer active. Fixes: #4240
This commit is contained in:
parent
a07117c938
commit
8f9d5e190e
1 changed files with 16 additions and 10 deletions
|
@ -151,12 +151,17 @@
|
||||||
this._id('creator-transform-switch').setAttribute("label", creatorNameBox.getAttribute("switch-mode-label"));
|
this._id('creator-transform-switch').setAttribute("label", creatorNameBox.getAttribute("switch-mode-label"));
|
||||||
});
|
});
|
||||||
|
|
||||||
// Ensure no button is forced to stay visible once the menu is cloed
|
// Ensure no button is forced to stay visible once the menu is closed
|
||||||
this.querySelector('#zotero-creator-transform-menu').addEventListener('popuphidden', (_) => {
|
this.addEventListener('popuphidden', (event) => {
|
||||||
let row = document.popupNode.closest('.meta-row');
|
for (let node of this.querySelectorAll('.show-without-hover')) {
|
||||||
for (let node of row.querySelectorAll('toolbarbutton.show-on-hover')) {
|
node.classList.remove('show-without-hover');
|
||||||
node.style.removeProperty('visibility');
|
node.classList.add("show-on-hover");
|
||||||
node.style.removeProperty('display');
|
}
|
||||||
|
// Some toolbarbuttons get stuck with open=true if popup is
|
||||||
|
// opened via keyboard (e.g. select version btn in merge mode)
|
||||||
|
let popupParent = event.target.parentElement;
|
||||||
|
if (popupParent?.getAttribute("open") == "true") {
|
||||||
|
popupParent.removeAttribute("open");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -672,7 +677,6 @@
|
||||||
this.querySelector('popupset').append(menupopup);
|
this.querySelector('popupset').append(menupopup);
|
||||||
menupopup.addEventListener('popuphidden', () => {
|
menupopup.addEventListener('popuphidden', () => {
|
||||||
menupopup.remove();
|
menupopup.remove();
|
||||||
optionsButton.style.visibility = '';
|
|
||||||
});
|
});
|
||||||
this.handlePopupOpening(e, menupopup);
|
this.handlePopupOpening(e, menupopup);
|
||||||
};
|
};
|
||||||
|
@ -2312,10 +2316,12 @@
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
|
let target = event.target;
|
||||||
let isRightClick = event.type == 'contextmenu';
|
let isRightClick = event.type == 'contextmenu';
|
||||||
if (!isRightClick) {
|
// Force button to show regardless of its hover status if applicable
|
||||||
event.target.style.visibility = "visible";
|
if (!isRightClick && target.classList.contains("show-on-hover")) {
|
||||||
event.target.style.display = "revert";
|
target.classList.add("show-without-hover");
|
||||||
|
target.classList.remove("show-on-hover");
|
||||||
}
|
}
|
||||||
// On click, we have x/y coordinates so use that
|
// On click, we have x/y coordinates so use that
|
||||||
// On keyboard click, open it next to the target
|
// On keyboard click, open it next to the target
|
||||||
|
|
Loading…
Reference in a new issue