Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MenuRenderer, OverflowMenu: Limit the menu height #1567

Merged
merged 5 commits into from
Aug 26, 2024
Merged
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
13 changes: 13 additions & 0 deletions .changeset/bright-nails-cry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'braid-design-system': patch
---

---
updated:
- MenuRenderer
- OverflowMenu
---

**MenuRenderer, OverflowMenu:** Limit the menu height

Limit the menu to show a maximum of around 10 items before scrolling (a little less so it's evident there is more to scroll to).
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ export const width = styleVariants({ small, medium, large }, (w) => [
export const placementBottom = style({
bottom: '100%',
});

export const menuYPadding = 'xxsmall';

export const menuHeightLimit = style({
maxHeight: calc(vars.touchableSize)
.multiply(9.5)
.add(vars.space[menuYPadding])
.toString(),
overflowY: 'auto',
});
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ export function Menu({
placement === 'top' && styles.placementBottom,
]}
>
<Box paddingY="xxsmall">
<Box paddingY={styles.menuYPadding} className={styles.menuHeightLimit}>
{Children.map(children, (item, i) => {
if (isDivider(item)) {
dividerCount++;
Expand Down