Prevent empty item type menu from appearing after Cmd-Shift-N when info section is collapsed (#4105)
If the info section is collapsed, do not try to focus and open the itemType menu as it can lead to an empty dropdown. Just focus the header title in that case
This commit is contained in:
parent
85f58cc97d
commit
8278140492
2 changed files with 9 additions and 0 deletions
|
@ -52,6 +52,10 @@ class ItemPaneSectionElementBase extends XULElementBase {
|
|||
this.setAttribute('tabType', tabType);
|
||||
}
|
||||
|
||||
get open() {
|
||||
return this._section?.open || false;
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback();
|
||||
if (!this.render && !this.asyncRender) {
|
||||
|
|
|
@ -1305,6 +1305,11 @@ var ZoteroPane = new function()
|
|||
var type = mru ? mru.split(',')[0] : 'book';
|
||||
await ZoteroPane.newItem(Zotero.ItemTypes.getID(type));
|
||||
let itemBox = document.getElementById('zotero-editpane-item-box');
|
||||
// If the info pane is collapsed, focus the title in the header
|
||||
if (!itemBox.open) {
|
||||
document.querySelector("#zotero-item-pane-header editable-text").focus();
|
||||
return;
|
||||
}
|
||||
var menu = itemBox.itemTypeMenu;
|
||||
// If the new item's type is changed immediately, update the MRU
|
||||
var handleTypeChange = function () {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue