Skip to content

Commit

Permalink
Remove focus from the toggleButton when closing the sidebar with a mo…
Browse files Browse the repository at this point in the history
…use (issue 17361)
  • Loading branch information
Snuffleupagus committed Dec 6, 2023
1 parent 7e64f82 commit 2abdc22
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions web/pdf_sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class PDFSidebar {
this.#hideUINotification();
}

close() {
close(evt = null) {
if (!this.isOpen) {
return;
}
Expand All @@ -276,11 +276,16 @@ class PDFSidebar {

this.onToggled();
this.#dispatchEvent();

if (evt?.detail > 0) {
// Remove focus from toggleButton if it was clicked (see issue 17361).
this.toggleButton.blur();
}
}

toggle() {
toggle(evt = null) {
if (this.isOpen) {
this.close();
this.close(evt);
} else {
this.open();
}
Expand Down Expand Up @@ -334,8 +339,8 @@ class PDFSidebar {
}
});

this.toggleButton.addEventListener("click", () => {
this.toggle();
this.toggleButton.addEventListener("click", evt => {
this.toggle(evt);
});

// Buttons for switching views.
Expand Down

0 comments on commit 2abdc22

Please sign in to comment.