Skip to content

Navbar sticky=top overlaps Dash's debug-error-card #515

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

Closed
amarvin opened this issue Feb 9, 2021 · 3 comments
Closed

Navbar sticky=top overlaps Dash's debug-error-card #515

amarvin opened this issue Feb 9, 2021 · 3 comments

Comments

@amarvin
Copy link
Contributor

amarvin commented Feb 9, 2021

  • dash version: 1.19.0
  • dash-bootstrap-components version: 0.11.1
  • components affected by bug: dbc.NavbarSimple and dbc.Navbar

What is happening?

Dash in debug mode nicely displays callback error traceback in a <div> with class debug-error-card, but the dash_bootstrap_components navbars overlap it when sticky="top", making the latest callback error traceback hard or impossible to read.

What should be happening?

Dash debug cards should display below or ontop of the dash_bootstrap_components navbar.

Code

import dash
import dash_bootstrap_components as dbc
import dash_html_components as html
from dash.dependencies import Input, Output, State

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

navbar1 = dbc.NavbarSimple(brand="dbc.NavbarSimple", sticky="top")
navbar2 = dbc.Navbar(
    dbc.Container(dbc.NavbarBrand("dbc.Navbar")),
    sticky="top",
)

content = dbc.Container(html.Button("Swap navbars", id="swap-navbars"))

app.layout = html.Div([navbar1, content], id="layout")


@app.callback(
    Output("layout", "children"),
    [Input("swap-navbars", "n_clicks")],
    [State("layout", "children")]
)
def raise_error(n_clicks, layout):
    if not n_clicks:
        # Raise a callback error initially
        raise TypeError
    elif layout[0]["type"] == "NavbarSimple":
        return [navbar2, content]
    else:
        return [navbar1, content]


if __name__ == "__main__":
    app.run_server(debug=True)

Error messages

image

@amarvin amarvin changed the title Navbar sticky top overlaps Dash's debug-error-card Navbar sticky=top overlaps Dash's debug-error-card Feb 9, 2021
@tcbegley
Copy link
Collaborator

Thanks for raising this @amarvin

It's because the sticky navbar has a higher z-index than the Dash error menu. I don't think we can get the Bootstrap style changed, but maybe the Plotly team would accept a PR adjusting the z-index of the error menu. I'll see what they think.

In the mean time, you can work around this by adding some custom CSS to your assets/ folder

.dash-error-card.dash-error-card--container {
    z-index: 1100;
}

@tcbegley
Copy link
Collaborator

Submitted a PR to fix this over at plotly/dash#1553

@tcbegley
Copy link
Collaborator

My PR to Dash was accepted, so this should be resolved as of their next release.

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