fix(mobile): super editor autocomplete dropdowns (#2019)

This commit is contained in:
Aman Harwara
2022-11-17 02:44:16 +05:30
committed by GitHub
parent bb64320f80
commit d21f3ba6f3
8 changed files with 44 additions and 13 deletions

View File

@@ -6,14 +6,18 @@ export const getPopoverMaxHeight = (
buttonRect: DOMRect | undefined,
side: PopoverSide,
alignment: PopoverAlignment,
disableMobileFullscreenTakeover?: boolean,
): number | 'none' => {
const matchesMediumBreakpoint = matchMedia(MediaQueryBreakpoints.md).matches
if (!matchesMediumBreakpoint) {
if (!matchesMediumBreakpoint && !disableMobileFullscreenTakeover) {
return 'none'
}
const MarginFromAppBorderInPX = 10
const topSafeAreaInset = parseInt(
getComputedStyle(document.documentElement).getPropertyValue('--safe-area-inset-top'),
)
let constraint = 0
@@ -21,6 +25,9 @@ export const getPopoverMaxHeight = (
switch (side) {
case 'top':
constraint = appRect.height - buttonRect.top
if (topSafeAreaInset > 0) {
constraint += topSafeAreaInset
}
break
case 'bottom':
constraint = buttonRect.bottom