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

navigation bar header items are not displayed properly #2022

Closed
dfguerrerom opened this issue Oct 28, 2024 · 5 comments · Fixed by #2066
Closed

navigation bar header items are not displayed properly #2022

dfguerrerom opened this issue Oct 28, 2024 · 5 comments · Fixed by #2066
Assignees
Labels
kind: bug Something isn't working

Comments

@dfguerrerom
Copy link

dfguerrerom commented Oct 28, 2024

As it can be seen in the image below, the header items are displayed wrongly when the width of the window is between 960 and 991px image

To reproduce

go to https://scitools.org.uk/cartopy/docs/latest/ and adjust the window to 975px

@drammock
Copy link
Collaborator

don't have time to look at the cause/fix today, but I can reproduce the problem.

@trallard trallard added kind: bug Something isn't working needs: investigation Someone in the team needs to investigate and try and reproduce this issue labels Nov 15, 2024
@melissawm
Copy link
Contributor

We are also observing this at napari/napari-sphinx-theme#178

@trallard
Copy link
Collaborator

I can confirm this happens in our docs at around 990px (say 1000px); see the screenshot below to see the docs at such a resolution.

image

@gabalafou @smeragoel do you have any suggestions on handling this from a usability/UX and implementation POV?
We might want to move the breakpoint at which the navbar is replaced with a hamburger menu (which appears to be triggering at around 940px right now, so 60-50 px might not make too much of a difference) WDYT?

ref:

image

@gabalafou
Copy link
Collaborator

I found the root cause.

Prior to PR #1955, we were importing our SCSS variable overrides before Bootstrap:

@import "variables/bootstrap";
@import "~bootstrap/scss/variables";

I think that 1955 inadvertently moved our "variables/bootstrap" after the Bootstrap import.

PR incoming.

@gabalafou
Copy link
Collaborator

Here's a deeper dive into how this broke.

In our variables/_bootstrap.scss, we redefine some Bootstrap breakpoints like so:

$container-max-widths: (
sm: 540px,
md: 720px,
lg: 960px,
xl: 1400px,
);
$grid-breakpoints: (
xs: 0,
sm: 540px,
md: 720px,
lg: 960px,
xl: 1200px,
);

Notice that we set lg in both $container-max-widths and $grid-breakpoints to 960px. In Bootstrap, these values differ: 960px and 992px. I don't know Bootstrap well enough to know why they differ, but the end result was that the 992px breakpoint caused the navbar links to go from flex "row" to "column" layout before hitting the 960px breakpoint for the mobile sidebar, creating a narrow 32-pixel-wide in-between zone in which we saw the wonky behavior described by this issue.

@gabalafou gabalafou removed the needs: investigation Someone in the team needs to investigate and try and reproduce this issue label Dec 3, 2024
trallard pushed a commit that referenced this issue Dec 5, 2024
This PR restores the effects of the variables defined in
[variables/_bootstrap.scss](https://github.com/pydata/pydata-sphinx-theme/blob/main/src/pydata_sphinx_theme/assets/styles/variables/_bootstrap.scss)

This fixes #2022 and
also fixes another issue that I had noticed when clicking links in the
"More" dropdown. Screenshots:

- Fixed: 

![](https://github.com/user-attachments/assets/060fa3fe-2ce8-4311-b127-7821ddbbdadc)
- Broken: 

![](https://github.com/user-attachments/assets/f1de59b9-e6a6-485f-8e83-22a3548de94f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants