File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
containers/Tenant/Diagnostics/TopQueries Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ interface SearchProps {
1515 className ?: string ;
1616 debounce ?: number ;
1717 placeholder ?: string ;
18+ inputRef ?: React . RefObject < HTMLInputElement > ;
1819}
1920
2021export const Search = ( {
@@ -24,6 +25,7 @@ export const Search = ({
2425 className,
2526 debounce = 200 ,
2627 placeholder,
28+ inputRef,
2729} : SearchProps ) => {
2830 const [ searchValue , setSearchValue ] = React . useState < string > ( value ) ;
2931
@@ -52,6 +54,7 @@ export const Search = ({
5254 < TextInput
5355 hasClear
5456 autoFocus
57+ controlRef = { inputRef }
5558 style = { { width} }
5659 className = { b ( null , className ) }
5760 placeholder = { placeholder }
Original file line number Diff line number Diff line change @@ -99,6 +99,14 @@ export const RunningQueriesData = ({
9999 [ setSelectedRow ] ,
100100 ) ;
101101
102+ const inputRef = React . useRef < HTMLInputElement > ( null ) ;
103+
104+ React . useEffect ( ( ) => {
105+ if ( isDrawerVisible ) {
106+ inputRef . current ?. blur ( ) ;
107+ }
108+ } , [ isDrawerVisible ] ) ;
109+
102110 return (
103111 < Drawer . ItemWrapper
104112 isDrawerVisible = { isDrawerVisible }
@@ -117,6 +125,7 @@ export const RunningQueriesData = ({
117125 onChange = { handleTextSearchUpdate }
118126 placeholder = { i18n ( 'filter.text.placeholder' ) }
119127 className = { b ( 'search' ) }
128+ inputRef = { inputRef }
120129 />
121130 < TableColumnSetup
122131 popupWidth = { 200 }
Original file line number Diff line number Diff line change @@ -127,6 +127,14 @@ export const TopQueriesData = ({
127127 [ setSelectedRow ] ,
128128 ) ;
129129
130+ const inputRef = React . useRef < HTMLInputElement > ( null ) ;
131+
132+ React . useEffect ( ( ) => {
133+ if ( isDrawerVisible ) {
134+ inputRef . current ?. blur ( ) ;
135+ }
136+ } , [ isDrawerVisible ] ) ;
137+
130138 return (
131139 < Drawer . ItemWrapper
132140 isDrawerVisible = { isDrawerVisible }
@@ -153,6 +161,7 @@ export const TopQueriesData = ({
153161 />
154162 < Search
155163 value = { filters . text }
164+ inputRef = { inputRef }
156165 onChange = { handleTextSearchUpdate }
157166 placeholder = { i18n ( 'filter.text.placeholder' ) }
158167 className = { b ( 'search' ) }
You can’t perform that action at this time.
0 commit comments