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

fix: Prevent last nav menu from overflowing #1727

Draft
wants to merge 2 commits into
base: src
Choose a base branch
from

Conversation

oliviergoulet5
Copy link
Member

Resolves #1726

@netlify
Copy link

netlify bot commented Sep 29, 2023

Deploy Preview for jakartaee ready!

Name Link
🔨 Latest commit 00d3fee
🔍 Latest deploy log https://app.netlify.com/sites/jakartaee/deploys/65172658b45e510008d1e67c
😎 Deploy Preview https://deploy-preview-1727--jakartaee.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@netlify
Copy link

netlify bot commented Sep 29, 2023

Deploy Preview for jakartaee ready!

Name Link
🔨 Latest commit d5da00e
🔍 Latest deploy log https://app.netlify.com/sites/jakartaee/deploys/651726b20fc7610008a36d6b
😎 Deploy Preview https://deploy-preview-1727--jakartaee.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

// Prevent menu from overflowing on the right side of the screen. The reason we
// are selecting the 2nd last child is because the last child is a mobile-only
// menu item.
#main-menu .navbar-nav li.dropdown:nth-last-child(2) {
Copy link
Member Author

@oliviergoulet5 oliviergoulet5 Sep 29, 2023

Choose a reason for hiding this comment

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

It might seem a bit hacky. I wanted to add a custom parameter to the menu item in menu.toml. Something like class or direction. However, Hugo doesn't allow params on menu items, only menus.

I also tried doing :last-of-type, but that selector only works with elements, not classes. That would've been perfect if it worked because I would select the last .dropdown.

Bootstrap introduced responsive menu direction classes in v4. When we migrate to v5, we could have a better solution using that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resources menu overflowing off the page at smaller screen widths
1 participant