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

Right align drop down menus on right side of navbar #2421

Merged
merged 5 commits into from
May 3, 2024
Merged

Right align drop down menus on right side of navbar #2421

merged 5 commits into from
May 3, 2024

Conversation

maelle
Copy link
Collaborator

@maelle maelle commented Mar 18, 2024

Bug noticed by @flor14

For vignettes with long titles, placing the articles on the right on the navbar means that the titles are truncated. The truncation also happen if the articles are on the left, for smaller screen sizes.

I'm trying to see whether adding a rule for text-wrap/max-width or the like can help. If I succeed, I'll remove the demo edits from this PR. 😇

image

Fixes #2476

@maelle

This comment was marked as outdated.

@maelle

This comment was marked as outdated.

@flor14

This comment was marked as outdated.

@maelle

This comment was marked as outdated.

@maelle

This comment was marked as outdated.

@hadley

This comment was marked as outdated.

@hadley
Copy link
Member

hadley commented Apr 19, 2024

Hmmm, I think this is going to be tricky to solve because currently the width of the dropdown is set by the maximum width of the text because .dropdown-item has white-space: nowrap. If we remove that, then the text wraps, but the width is now set by the minimum width of .dropdown-menu which comes from --bs-dropdown-min-width. So you'd need to set that as well.

...

Oh, maybe a better way to solve this is to right-align the dropdown, so there's all the space to the left. This requires adding the dropdown-menu-end class, https://getbootstrap.com/docs/5.3/components/dropdowns/#menu-alignment, which we could add automatically to all dropdowns in the right menu bar.

@maelle do you want to have a go at that? I think it's just a matter of adding a side = c("left", "right") to bs4_navbar_links_tags(), ensuring it gets pass all the way down from navbar_links(), and then adding the dropdown-menu-end class to menus on the right. Otherwise I can do it.

@maelle

This comment was marked as outdated.

@maelle

This comment was marked as outdated.

@hadley

This comment was marked as outdated.

@hadley
Copy link
Member

hadley commented Apr 23, 2024

This looks correct to me

Screenshot 2024-04-23 at 08 55 53

@hadley hadley changed the title demo a website with long titles on the right Right align drop down menus on right side of navbar Apr 23, 2024
@hadley hadley marked this pull request as ready for review April 23, 2024 19:02
@hadley
Copy link
Member

hadley commented Apr 23, 2024

Fixes #2476@maelle this is good for review when you get back.

@maelle
Copy link
Collaborator Author

maelle commented May 3, 2024

This won't be enough for very long titles. Should it be possible to choose a different title for the navbar. 🤔

image

@hadley
Copy link
Member

hadley commented May 3, 2024

Let’s merge this and then think of the mobile issue separately (#2512).

@hadley hadley merged commit c56da52 into main May 3, 2024
12 checks passed
@hadley hadley deleted the overflow branch May 3, 2024 20:35
SebKrantz pushed a commit to SebKrantz/pkgdown that referenced this pull request Jun 1, 2024
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.

Right-align dropdowns on the right side of the navbar
3 participants