Potentially improve main menu positioning.
This commit is contained in:
parent
74cb027fd7
commit
5082142b36
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
.dropdown-menu-container {
|
.dropdown-menu-container {
|
||||||
background-color: #fff !important;
|
background-color: #fff !important;
|
||||||
max-height: calc(100vh - 150px);
|
max-height: var(--radix-popper-available-height);
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
--gap: 2;
|
--gap: 2;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ const MenuContent = ({
|
|||||||
style,
|
style,
|
||||||
sideOffset = 4,
|
sideOffset = 4,
|
||||||
align = "start",
|
align = "start",
|
||||||
|
collisionPadding,
|
||||||
}: {
|
}: {
|
||||||
children?: React.ReactNode;
|
children?: React.ReactNode;
|
||||||
onClickOutside?: () => void;
|
onClickOutside?: () => void;
|
||||||
@ -27,6 +28,9 @@ const MenuContent = ({
|
|||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
sideOffset?: number;
|
sideOffset?: number;
|
||||||
align?: "start" | "center" | "end";
|
align?: "start" | "center" | "end";
|
||||||
|
collisionPadding?:
|
||||||
|
| number
|
||||||
|
| Partial<Record<"top" | "right" | "bottom" | "left", number>>;
|
||||||
}) => {
|
}) => {
|
||||||
const device = useDevice();
|
const device = useDevice();
|
||||||
const menuRef = useRef<HTMLDivElement>(null);
|
const menuRef = useRef<HTMLDivElement>(null);
|
||||||
@ -49,6 +53,7 @@ const MenuContent = ({
|
|||||||
side="bottom"
|
side="bottom"
|
||||||
sideOffset={sideOffset}
|
sideOffset={sideOffset}
|
||||||
align={align}
|
align={align}
|
||||||
|
collisionPadding={collisionPadding}
|
||||||
>
|
>
|
||||||
{/* the zIndex ensures this menu has higher stacking order,
|
{/* the zIndex ensures this menu has higher stacking order,
|
||||||
see https://github.com/excalidraw/excalidraw/pull/1445 */}
|
see https://github.com/excalidraw/excalidraw/pull/1445 */}
|
||||||
|
@ -68,6 +68,15 @@ const MainMenu = Object.assign(
|
|||||||
onSelect={composeEventHandlers(onSelect, () => {
|
onSelect={composeEventHandlers(onSelect, () => {
|
||||||
setAppState({ openMenu: null });
|
setAppState({ openMenu: null });
|
||||||
})}
|
})}
|
||||||
|
collisionPadding={
|
||||||
|
// accounting for
|
||||||
|
// - editor footer on desktop
|
||||||
|
// - toolbar on mobile
|
||||||
|
// we probably don't want the menu to overlay these elements
|
||||||
|
!device.isMobile
|
||||||
|
? { bottom: 90, top: 10 }
|
||||||
|
: { top: 90, bottom: 10 }
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
{device.isMobile && appState.collaborators.size > 0 && (
|
{device.isMobile && appState.collaborators.size > 0 && (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user