Skip to content

Commit

Permalink
Adds a guard clause for if the _inputRef doesn't exist when the anima…
Browse files Browse the repository at this point in the history
…tionFrame is executed. Fixes ssleptsov#34
  • Loading branch information
jwoertink committed Dec 14, 2022
1 parent 8a47b20 commit 46b349b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ninja-header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class NinjaHeader extends LitElement {
}

focusSearch() {
requestAnimationFrame(() => this._inputRef.value!.focus());
requestAnimationFrame(() => (this._inputRef && this._inputRef.value!.focus()));
}

private _handleInput(event: Event) {
Expand Down

0 comments on commit 46b349b

Please sign in to comment.