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

Commit 7676792

Browse files
committed
fix(plugins/plugin-client-common): input may not receive focus on tab switch
Fixes #5102
1 parent ab77c20 commit 7676792

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,17 @@ export default class TabContainer extends React.PureComponent<Props, State> {
6565
})
6666
}
6767

68-
/** temporary hack to regrab focus to the repl */
68+
/**
69+
* Temporary hack to regrab focus to the repl. The hack part is the
70+
* querySelector. This really needs to be done in TabContent, which
71+
* owns the Tab impl.
72+
*
73+
*/
6974
private hackFocus() {
7075
setTimeout(() => {
7176
try {
72-
const input = document.querySelector(
73-
`tab[data-tab-id="${this.state.activeIdx + 1}"] .repl-active input`
74-
) as HTMLElement
77+
const selector = `.kui--tab-content[data-tab-id="${this.state.activeIdx + 1}"] .repl-active input`
78+
const input = document.querySelector(selector) as HTMLElement
7579
if (input) {
7680
input.focus()
7781
}

0 commit comments

Comments
 (0)