Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/ariakit/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,10 @@
height: fit-content;
justify-items: center;
max-height: inherit;
box-sizing: border-box;
max-width: 100vw;
overflow-x: auto;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
overscroll-behavior-x: none;
overflow-y: auto;
padding: 20px;
}
Expand Down
4 changes: 4 additions & 0 deletions packages/mantine/src/blocknoteStyles.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
13 changes: 12 additions & 1 deletion packages/react/src/util/elementOverflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,23 @@ 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"
: topOverflow
? "top"
: bottomOverflow
? "bottom"
: "none";
: horizontalOverflow;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this returns "both" two different cases, so consumers can't distinguish between them.

Afaik we only check for "none", so it's better to change this function to a boolean isElementOverflowing.

Or, go one step further and see if we can just call https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoViewIfNeeded or https://github.com/scroll-into-view/scroll-into-view-if-needed, but not sure if any of these are a 1:1 fit and actually better, so needs some research

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const GridSuggestionMenu = forwardRef<
<div
// Styles from ShadCN DropdownMenuContent component
className={cn(
"bg-popover text-popover-foreground z-50 min-w-32 overflow-x-hidden overflow-y-auto rounded-md p-1 shadow-md ring-1 ring-foreground/10",
"bg-popover text-popover-foreground z-50 box-border max-w-screen overflow-x-auto overflow-y-auto overscroll-x-none rounded-md p-1 shadow-md ring-1 ring-foreground/10",
"grid",
className,
)}
Expand Down
Loading