@@ -28,7 +28,9 @@ export function getPropGetters<
2828 TMouseEvent ,
2929 TKeyboardEvent
3030> ( { props, refresh, store, ...setters } : GetPropGettersOptions < TItem > ) {
31- const getEnvironmentProps : GetEnvironmentProps = ( getterProps ) => {
31+ const getEnvironmentProps : GetEnvironmentProps = ( providedProps ) => {
32+ const { inputElement, formElement, panelElement, ...rest } = providedProps ;
33+
3234 return {
3335 // On touch devices, we do not rely on the native `blur` event of the
3436 // input to close the panel, but rather on a custom `touchstart` event
@@ -38,25 +40,24 @@ export function getPropGetters<
3840 onTouchStart ( event ) {
3941 if (
4042 store . getState ( ) . isOpen === false ||
41- event . target === getterProps . inputElement
43+ event . target === inputElement
4244 ) {
4345 return ;
4446 }
4547
4648 // @TODO : support cases where there are multiple Autocomplete instances.
4749 // Right now, a second instance makes this computation return false.
48- const isTargetWithinAutocomplete = [
49- getterProps . formElement ,
50- getterProps . panelElement ,
51- ] . some ( ( contextNode ) => {
52- return (
53- isOrContainsNode ( contextNode , event . target as Node ) ||
54- isOrContainsNode (
55- contextNode ,
56- props . environment . document . activeElement !
57- )
58- ) ;
59- } ) ;
50+ const isTargetWithinAutocomplete = [ formElement , panelElement ] . some (
51+ ( contextNode ) => {
52+ return (
53+ isOrContainsNode ( contextNode , event . target as Node ) ||
54+ isOrContainsNode (
55+ contextNode ,
56+ props . environment . document . activeElement !
57+ )
58+ ) ;
59+ }
60+ ) ;
6061
6162 if ( isTargetWithinAutocomplete === false ) {
6263 store . dispatch ( 'blur' , null ) ;
@@ -69,15 +70,15 @@ export function getPropGetters<
6970 onTouchMove ( event : TouchEvent ) {
7071 if (
7172 store . getState ( ) . isOpen === false ||
72- getterProps . inputElement !==
73- props . environment . document . activeElement ||
74- event . target === getterProps . inputElement
73+ inputElement !== props . environment . document . activeElement ||
74+ event . target === inputElement
7575 ) {
7676 return ;
7777 }
7878
79- getterProps . inputElement . blur ( ) ;
79+ inputElement . blur ( ) ;
8080 } ,
81+ ...rest ,
8182 } ;
8283 } ;
8384
0 commit comments