diff --git a/packages/autocomplete-js/src/autocomplete.ts b/packages/autocomplete-js/src/autocomplete.ts index 7dc5003bd..112e37028 100644 --- a/packages/autocomplete-js/src/autocomplete.ts +++ b/packages/autocomplete-js/src/autocomplete.ts @@ -281,7 +281,7 @@ export function autocomplete( toggleModalClassname(event.matches); } - const isModalDetachedMql = window.matchMedia( + const isModalDetachedMql = props.value.core.environment.matchMedia( getComputedStyle( props.value.core.environment.document.documentElement ).getPropertyValue('--aa-detached-modal-media-query') diff --git a/packages/autocomplete-js/src/getPanelPlacementStyle.ts b/packages/autocomplete-js/src/getPanelPlacementStyle.ts index 56a75611c..40516636e 100644 --- a/packages/autocomplete-js/src/getPanelPlacementStyle.ts +++ b/packages/autocomplete-js/src/getPanelPlacementStyle.ts @@ -1,7 +1,7 @@ import { AutocompleteOptions } from './types'; type GetPanelPlacementStyleParams = Pick< - AutocompleteOptions, + Required>, 'panelPlacement' | 'environment' > & { container: HTMLElement; @@ -12,7 +12,7 @@ export function getPanelPlacementStyle({ panelPlacement, container, form, - environment = window, + environment, }: GetPanelPlacementStyleParams) { const containerRect = container.getBoundingClientRect(); const top = container.offsetTop + containerRect.height;