-
Notifications
You must be signed in to change notification settings - Fork 198
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 top navbar style #1719
Fix top navbar style #1719
Conversation
In my local Chrome, with the light theme, it looks like this: There are grey rectangles between the menu names. Looking the Dev Tools, it appears to be due to these rules in the light CSS:
Those are getting applied to the |
Great catch! I'll check tomorrow what's going on. |
templates/style/_navbar.scss
Outdated
max-height: 100%; | ||
overflow-x: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these lines are unnecessary. When I remove these properties locally, the unwanted grey rectangles (which are tiny vertical scrollbars) go away. Also, with these properties removed, even if the menu items' font size is weird, it doesn't interfere with the main page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In fact, I think this whole CSS rule (including the comment about what happens with a locally installed old Fira Sans) should get deleted. Switching to the flex layout seems like it sufficed to fix the issue with overflowing menu titles, even without this rule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I just tested in a locally installed Firefox, with the Fira Sans from #1669 (comment), at these commits:
- ad8d4fe (i.e. right before Set overflow-y: hidden on navbar #1711)
- 0ae5807 (this branch)
- 0ae5807 with this CSS rule removed
And I can confirm that at (1) I have the overflow issue. Both (2) and (3) fix the overflow issue, and (3) additionally fixes the scrollbar issue introduced in this branch.
BTW the scrollbar issue seems to be Chrome-only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
templates/style/_navbar.scss
Outdated
position: relative; | ||
|
||
.container, .pure-menu-horizontal { | ||
position: relative; | ||
height: 100%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the position: relative
and height: 100%
needed for here? I think they are unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's because with this, we can set the element of the navbar to height: 100%
. It prevents the bottom margin to disappear in case the font size is too big.
form.landing-search-form-nav { | ||
max-width: 1200px; | ||
height: 100%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can get rid of this height: 100%
. That makes the search field vertically misaligned, but you can fix that by also removing the height: 100%
on line 92.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
templates/style/_navbar.scss
Outdated
max-width: 150px; | ||
display: none; | ||
border-left: 1px solid var(--color-border); | ||
height: 100%; | ||
overflow-x: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need overflow-x: hidden
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a trick I used to fix the scrollbar issue when the font-size is too big. I thought flex-shrink: 1
would do it but apparently it doesn't...
} | ||
|
||
.pure-menu-item { | ||
height: 100%; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is also unnecessary.
Overall, great change! I am really happy to have the items show up in the same HTML order as the visual order on the page. |
I can't reproduce it on my chrome: Any idea what's going on in yours? Do you have some extension or some other custom setting maybe? |
Mine is Chrome Version 100.0.4896.88 (Official Build) (64-bit) on Ubuntu 21.10. It still reproduces when I run I do have that old copy of Fira Sans still installed, which probably contributes. If I remove the If you follow the tweaks I recommended above that will fix things. |
I tested all of them and they all ended up in bad rendering in firefox. :-/ EDIT: I forgot to precise: bad rendering when the minimum font size is more than expected. |
Which type of bad rendering? The "body text is too narrow" bad rendering? Or "bottom border of menu title is not visible"? |
I spent some time fiddling with this locally and came up with a solution that I think is tidier, avoids the scrollbars on Chrome, and looks right on both Chrome and Firefox. I sent it as a PR against your branch: GuillaumeGomez#1. Let me know what you think! |
Nice, thanks a lot! Will test it locally as soon as possible. |
Fix overflowing navbar without max-height.
I integrated @jsha's improvements so this should now be ready! |
I've manually tested the version on this branch in Firefox and Chrome, with the old version of Fira Sans locally installed. Tests I did:
I also tested with a large font size in firefox, and a large minimum font size. The presentation wasn't perfect but it was good enough. And it didn't interere with the rustdoc content. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, definitely fixes #1725
I just realized that the display of the top navbar menu is broken (well, not good looking):
It comes from my changes in #1717 to allow having a different font size.
Overall, the style for the top navbar is quite the nightmare so I decided to remove the
float
properties and to useflex
instead. The result is quite nice (imo) and fixes some small UI issues:And it looks like this with bigger font size:
I checked other pages and they work well too.