Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit a16b680

Browse files
committed
fix(plugins/plugin-client-common): improve error handling of hackFocus
Fixes #3769
1 parent b075b7b commit a16b680

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugins/plugin-client-common/src/components/TabContainer.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ export default class TabContainer extends React.PureComponent<Props, State> {
7070
private hackFocus() {
7171
setTimeout(() => {
7272
try {
73-
;(document.querySelector(
73+
const input = document.querySelector(
7474
`tab[data-tab-id="${this.state.activeIdx + 1}"] .repl-active input`
75-
) as HTMLElement).focus()
75+
) as HTMLElement
76+
if (input) {
77+
input.focus()
78+
}
7679
} catch (err) {
7780
console.error(err)
7881
}

0 commit comments

Comments
 (0)