@@ -27,7 +27,6 @@ import {
2727 EuiIcon ,
2828 EuiBadge ,
2929 EuiButtonIcon ,
30- EuiOutsideClickDetector ,
3130} from '@elastic/eui' ;
3231import { FormattedMessage } from '@kbn/i18n/react' ;
3332import { i18n } from '@kbn/i18n' ;
@@ -100,9 +99,6 @@ export function SelectableUrlList({
10099 onTermChange ( ) ;
101100 onApply ( ) ;
102101 setPopoverIsOpen ( false ) ;
103- if ( searchRef ) {
104- searchRef . blur ( ) ;
105- }
106102 }
107103 } ;
108104
@@ -120,15 +116,11 @@ export function SelectableUrlList({
120116
121117 const closePopover = ( ) => {
122118 setPopoverIsOpen ( false ) ;
123- if ( searchRef ) {
124- searchRef . blur ( ) ;
125- }
126119 } ;
127120
128121 // @ts -ignore - not sure, why it's not working
129122 useEvent ( 'keydown' , onEnterKey , searchRef ) ;
130123 useEvent ( 'escape' , ( ) => setPopoverIsOpen ( false ) , searchRef ) ;
131- useEvent ( 'blur' , ( ) => setPopoverIsOpen ( false ) , searchRef ) ;
132124
133125 useEffect ( ( ) => {
134126 if ( searchRef && initialValue ) {
@@ -207,65 +199,63 @@ export function SelectableUrlList({
207199 allowExclusions = { true }
208200 >
209201 { ( list , search ) => (
210- < EuiOutsideClickDetector onOutsideClick = { ( ) => closePopover ( ) } >
211- < EuiPopover
212- panelPaddingSize = "none"
213- isOpen = { popoverIsOpen }
214- display = { 'block' }
215- button = { search }
216- closePopover = { closePopover }
217- style = { { minWidth : 400 } }
218- anchorPosition = "downLeft"
219- ownFocus = { false }
202+ < EuiPopover
203+ panelPaddingSize = "none"
204+ isOpen = { popoverIsOpen }
205+ display = { 'block' }
206+ button = { search }
207+ closePopover = { closePopover }
208+ style = { { minWidth : 400 } }
209+ anchorPosition = "downLeft"
210+ ownFocus = { false }
211+ >
212+ < div
213+ style = { {
214+ width : searchRef ?. getBoundingClientRect ( ) . width ?? 600 ,
215+ maxWidth : '100%' ,
216+ } }
220217 >
221- < div
222- style = { {
223- width : searchRef ?. getBoundingClientRect ( ) . width ?? 600 ,
224- maxWidth : '100%' ,
225- } }
226- >
227- < PopOverTitle />
228- { searchValue && (
229- < StyledRow darkMode = { darkMode } >
230- < EuiText size = "s" >
231- < FormattedMessage
232- id = "xpack.apm.ux.url.hitEnter.include"
233- defaultMessage = "Hit {icon} or click apply to include all urls matching {searchValue}"
234- values = { {
235- searchValue : < strong > { searchValue } </ strong > ,
236- icon : (
237- < EuiBadge color = "hollow" >
238- Enter < EuiIcon type = "returnKey" />
239- </ EuiBadge >
240- ) ,
241- } }
242- />
243- </ EuiText >
244- </ StyledRow >
245- ) }
246- { list }
247- < EuiPopoverFooter paddingSize = "s" >
248- < EuiFlexGroup style = { { justifyContent : 'flex-end' } } >
249- < EuiFlexItem grow = { false } >
250- < EuiButton
251- fill
252- size = "s"
253- onClick = { ( ) => {
254- onTermChange ( ) ;
255- onApply ( ) ;
256- closePopover ( ) ;
257- } }
258- >
259- { i18n . translate ( 'xpack.apm.apply.label' , {
260- defaultMessage : 'Apply' ,
261- } ) }
262- </ EuiButton >
263- </ EuiFlexItem >
264- </ EuiFlexGroup >
265- </ EuiPopoverFooter >
266- </ div >
267- </ EuiPopover >
268- </ EuiOutsideClickDetector >
218+ < PopOverTitle />
219+ { searchValue && (
220+ < StyledRow darkMode = { darkMode } >
221+ < EuiText size = "s" >
222+ < FormattedMessage
223+ id = "xpack.apm.ux.url.hitEnter.include"
224+ defaultMessage = "Hit {icon} or click apply to include all urls matching {searchValue}"
225+ values = { {
226+ searchValue : < strong > { searchValue } </ strong > ,
227+ icon : (
228+ < EuiBadge color = "hollow" >
229+ Enter < EuiIcon type = "returnKey" />
230+ </ EuiBadge >
231+ ) ,
232+ } }
233+ />
234+ </ EuiText >
235+ </ StyledRow >
236+ ) }
237+ { list }
238+ < EuiPopoverFooter paddingSize = "s" >
239+ < EuiFlexGroup style = { { justifyContent : 'flex-end' } } >
240+ < EuiFlexItem grow = { false } >
241+ < EuiButton
242+ fill
243+ size = "s"
244+ onClick = { ( ) => {
245+ onTermChange ( ) ;
246+ onApply ( ) ;
247+ closePopover ( ) ;
248+ } }
249+ >
250+ { i18n . translate ( 'xpack.apm.apply.label' , {
251+ defaultMessage : 'Apply' ,
252+ } ) }
253+ </ EuiButton >
254+ </ EuiFlexItem >
255+ </ EuiFlexGroup >
256+ </ EuiPopoverFooter >
257+ </ div >
258+ </ EuiPopover >
269259 ) }
270260 </ EuiSelectable >
271261 ) ;
0 commit comments