Merge pull request #17386 from Snuffleupagus/issue-17361

Remove focus from the toggleButton when closing the sidebar with a mouse (issue 17361)
This commit is contained in:
Jonas Jenwald 2023-12-06 16:21:18 +01:00 committed by GitHub
commit a692f8681b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -264,7 +264,7 @@ class PDFSidebar {
this.#hideUINotification(); this.#hideUINotification();
} }
close() { close(evt = null) {
if (!this.isOpen) { if (!this.isOpen) {
return; return;
} }
@ -276,11 +276,16 @@ class PDFSidebar {
this.onToggled(); this.onToggled();
this.#dispatchEvent(); this.#dispatchEvent();
if (evt?.detail > 0) {
// Remove focus from the toggleButton if it's clicked (see issue 17361).
this.toggleButton.blur();
}
} }
toggle() { toggle(evt = null) {
if (this.isOpen) { if (this.isOpen) {
this.close(); this.close(evt);
} else { } else {
this.open(); this.open();
} }
@ -334,8 +339,8 @@ class PDFSidebar {
} }
}); });
this.toggleButton.addEventListener("click", () => { this.toggleButton.addEventListener("click", evt => {
this.toggle(); this.toggle(evt);
}); });
// Buttons for switching views. // Buttons for switching views.