So i have in my layout a nav bar with a simple dropdown in it:
dropdown = dbc.DropdownMenu(
children=[
dbc.DropdownMenuItem("Settings", href='/settings'),
dbc.DropdownMenuItem("Logout", href='/logout'),
],
id='nav_dropdown'
)
return [
dbc.Nav([
html.Div([
html.A('Some link that works', className='navbar-brand', href='/logout'),
html.Div([dcc.Location(id='url', refresh=True),
html.Ul([dropdown], className='navbar-nav me-right', id='nav_dropdown_container')],
id='navbarColor01',
className='collapse navbar-collapse')
],
className='container-fluid',
id='nav_div')
],
navbar=True,
className='navbar navbar-expand-lg navbar-dark bg-primary')]
I can see the dropdown just fine, when for example in the browser i select “Logout”. i see that the URL changes to:
site/logout
but it doesnt call the logout endpoint, this is defined as a Flask endpoint via a blueprint. whats weirder is that the url bar in the brower changes, and nothing happens. however if i select the URL and hit enter, then the redirect occurs.
you’ll note i have a static html.A reference in the nav bar also to ‘/logout’. this works as expected. Why wont the href link work in a dropdown?
Thanks-