Skip to content

Commit c5e275e

Browse files
feat(menu): optimize responsive menu overflow handling
- Increase buffer space for More dropdown from 100px to 300px for better spacing - Remove hard limit of 8 visible menu items to allow more flexible overflow - Add whitespace-nowrap to root-level menu items to prevent text wrapping - Improve menu item visibility calculation for better responsive behavior
1 parent 98f8b42 commit c5e275e

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/assets/js/partials/main-menu.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,15 +194,15 @@ class NavigationMenu extends HTMLElement {
194194
}
195195
});
196196

197-
const availableWidth = containerWidth - usedWidth - 100; // 100px buffer for More dropdown
197+
const availableWidth = containerWidth - usedWidth - 300; // 300px buffer for More dropdown
198198
let currentWidth = 0;
199199
let visibleCount = 0;
200200

201201
// Check each menu item
202202
menuItems.forEach((item, index) => {
203203
const itemWidth = item.offsetWidth;
204204

205-
if (currentWidth + itemWidth <= availableWidth && index < this.menus.length && visibleCount < 8) {
205+
if (currentWidth + itemWidth <= availableWidth && index < this.menus.length) {
206206
currentWidth += itemWidth;
207207
visibleCount++;
208208
} else {

src/assets/styles/04-components/menus.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
@apply inline-block;
2323

2424
> a{
25-
@apply font-bold pt-0 pb-8;
25+
@apply font-bold pt-0 pb-8 whitespace-nowrap;
2626
}
2727
}
2828
}

0 commit comments

Comments
 (0)