Skip to content

Commit

Permalink
Fix infinite recursion in DOMView#focus()
Browse files Browse the repository at this point in the history
  • Loading branch information
AbeJellinek committed Aug 16, 2023
1 parent c4c0dfd commit c26e1bb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dom/common/dom-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -948,9 +948,11 @@ abstract class DOMView<State extends DOMViewState, Data> {
// ***

focus() {
// The iframe sometimes won't correctly get focus unless we focus the outer window first
window.focus();
this._iframe.focus();
if (document.activeElement !== this._iframe || !this._iframeDocument.activeElement) {
// The iframe sometimes won't correctly get focus unless we focus the outer window first
window.focus();
this._iframe.focus();
}
}

navigate(location: NavLocation, options: NavigateOptions = {}) {
Expand Down

0 comments on commit c26e1bb

Please sign in to comment.