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

has-navbar-fixed-top doesn't add enough padding for spaced navbars #3923

Open
jmbluethner opened this issue Oct 25, 2024 · 1 comment
Open

Comments

@jmbluethner
Copy link

This is about Bulma.
It's most likely a bug

Overview of the problem

This is about the Bulma CSS framework
I'm using Bulma version v1.0.2
My browser is: Chrome 130.0.6723.70 (64-Bit)

Description

When using a fixed navbar as described in the docs by adding
class="has-navbar-fixed-top" to the html DOM element and
class="navbar is-fixed-top" to the nav element, the nav is fixed and html gets a top padding like

body.has-navbar-fixed-top, html.has-navbar-fixed-top {
    padding-top: var(--bulma-navbar-height);
}

In addition to the steps described above, I've also added is-spaced to the navbar in order to give it some padding.
So, in total, this is my root nav DOM element:

<nav class="navbar is-fixed-top is-spaced has-shadow" role="navigation" aria-label="main navigation"></nav>

Now the problem is, that the spacing added by <html class="has-navbar-fixed-top"> does in fact add a padding, BUT it does NOT accout for the additional space taken by the navbar because of is-spaced.

This results in the problem, that content after the navbar is slightly too high and overflows behind the navbar.

image

This isn't a big deal because this can be easily fixed with some custom css, however it would be nice to get this fixed in a future release 😃

Steps to Reproduce

Add a fixed navbar with additional class is-spaced.

Expected behavior

html.has-navbar-fixed-top should not just add a padding of var(--bulma-navbar-height), but should instead increase that value if the navbar is set to is-spaced.

Actual behavior

html.has-navbar-fixed-top doesn't add enough padding for the <html> element and content therefore starts behind the navbar.

Potential Fix

html.has-navbar-fixed-top:has(nav.is-fixed-top.is-spaced) {
    padding-top: calc(var(--bulma-navbar-height) + (var(--bulma-navbar-padding-horizontal)));
}

This would work in theory, but it doesn't because --bulma-navbar-padding-horizontal is defined within .navbar, and not for :root.
So this is just the first idea I came up with. Thought it might help :)

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

No branches or pull requests

2 participants
@jmbluethner and others