diff --git a/packages/ariakit/src/style.css b/packages/ariakit/src/style.css index 59974a6d60..17c68be36c 100644 --- a/packages/ariakit/src/style.css +++ b/packages/ariakit/src/style.css @@ -157,6 +157,10 @@ height: fit-content; justify-items: center; max-height: inherit; + box-sizing: border-box; + max-width: 100vw; + overflow-x: auto; + overscroll-behavior-x: none; overflow-y: auto; padding: 20px; } diff --git a/packages/mantine/src/blocknoteStyles.css b/packages/mantine/src/blocknoteStyles.css index b219cfb628..6f85763a7a 100644 --- a/packages/mantine/src/blocknoteStyles.css +++ b/packages/mantine/src/blocknoteStyles.css @@ -441,6 +441,10 @@ height: fit-content; justify-items: center; max-height: inherit; + box-sizing: border-box; + max-width: 100vw; + overflow-x: auto; + overscroll-behavior-x: none; overflow-y: auto; padding: 20px; } diff --git a/packages/react/src/util/elementOverflow.ts b/packages/react/src/util/elementOverflow.ts index 6a98cbd003..82f0771f54 100644 --- a/packages/react/src/util/elementOverflow.ts +++ b/packages/react/src/util/elementOverflow.ts @@ -4,6 +4,17 @@ export function elementOverflow(element: HTMLElement, container: HTMLElement) { const topOverflow = elementRect.top < parentRect.top; const bottomOverflow = elementRect.bottom > parentRect.bottom; + const leftOverflow = elementRect.left < parentRect.left; + const rightOverflow = elementRect.right > parentRect.right; + + const horizontalOverflow = + leftOverflow && rightOverflow + ? "both" + : leftOverflow + ? "left" + : rightOverflow + ? "right" + : "none"; return topOverflow && bottomOverflow ? "both" @@ -11,5 +22,5 @@ export function elementOverflow(element: HTMLElement, container: HTMLElement) { ? "top" : bottomOverflow ? "bottom" - : "none"; + : horizontalOverflow; } diff --git a/packages/shadcn/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx b/packages/shadcn/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx index f8c95331b8..a79ffb49f0 100644 --- a/packages/shadcn/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx +++ b/packages/shadcn/src/suggestionMenu/gridSuggestionMenu/GridSuggestionMenu.tsx @@ -16,7 +16,7 @@ export const GridSuggestionMenu = forwardRef<