Skip to content

Commit 257a408

Browse files
committed
fix: enhance keyboard navigation by focusing select picker after custom option click
1 parent 9f9b8c9 commit 257a408

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/components/ResourceBrowser/ResourceList/NodeListSearchFilter.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,21 +64,22 @@ const NodeListSearchFilter = ({
6464
searchFilterRef.current?.openMenu('first')
6565
}
6666

67-
const handleBlurInput = () => {
68-
searchFilterRef.current?.blur()
69-
}
70-
7167
if (registerShortcut) {
7268
registerShortcut({ keys: ['/'], callback: handleFocusInput })
73-
registerShortcut({ keys: ['Escape'], callback: handleBlurInput })
7469
}
7570

7671
return () => {
7772
unregisterShortcut(['/'])
78-
unregisterShortcut(['Escape'])
7973
}
8074
}, [])
8175

76+
useEffect(() => {
77+
// focusing select picker after custom option click
78+
if (nodeSearchKey) {
79+
searchFilterRef.current?.focus()
80+
}
81+
}, [nodeSearchKey])
82+
8283
// ASYNC CALLS
8384
const [nodeK8sVersionsLoading, nodeK8sVersionOptions, nodeK8sVersionsError, refetchNodeK8sVersions] =
8485
useAsync(async () => {

0 commit comments

Comments
 (0)