Skip to content

Commit

Permalink
Restore focus after closing popup
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Jun 21, 2024
1 parent 3e65e2f commit d575d00
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/focus-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class FocusManager {
// Some browsers (Chrome) trigger focus event when focusing an iframe and some not (Firefox),
// therefore just use an interval because document.activeElement is always correct
setInterval(() => {
if (document.activeElement !== document.body && !document.activeElement.closest('.context-menu')) {
if (document.activeElement !== document.body && !document.activeElement.closest('.context-menu-overlay')) {
this._lastActiveElement = document.activeElement;
}
}, 100);
Expand Down
3 changes: 3 additions & 0 deletions src/common/reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -676,6 +676,9 @@ class Reader {
document.querySelector(selector)?.focus();
}, 100);
}
else {
this._focusManager.restoreFocus();
}
}

toggleFindPopup({ primary, open } = {}) {
Expand Down

0 comments on commit d575d00

Please sign in to comment.