Clicking filename label should focus/blur field in attachment box

This commit is contained in:
windingwind 2024-01-25 10:00:41 +08:00 committed by Dan Stillman
parent f990cb3f4b
commit 7fe01d6c03

View file

@ -263,6 +263,8 @@
reindexButton.click();
}
});
this.querySelectorAll(".meta-label").forEach(label => label.addEventListener("click", this._handleMetaLabelClick));
}
destroy() {
@ -622,6 +624,16 @@
await this.item.saveTx();
}
_handleMetaLabelClick = (event) => {
let labelWrapper = event.target.closest(".meta-label");
if (labelWrapper.nextSibling.contains(document.activeElement)) {
document.activeElement.blur();
}
else if (!labelWrapper.nextSibling.firstChild.readOnly) {
labelWrapper.nextSibling.firstChild.focus();
}
};
_id(id) {
return this.querySelector(`#${id}`);
}