Skip to content

[BUG] Dash 4.0.0 dcc.DatePickerSingle not showing date in unfocused dbc.Tabs #3625

@ColinGeukes

Description

@ColinGeukes

First of all, thank you so much the amazing visual update on 4.0.0!
All components that were quite basic got tackled and now allow for way more convient usage!

Context

dash                       4.0.0
dash-bootstrap-components  2.0.4
  • OS: macOS
  • Browser Chrome
  • Version 145.0.7632.45

Describe the bug

The dcc.DatePickerSingle has no visibile date if the date picker was inside a tab that was not in focus on the page load. While it works correctly if it is inside a tab that was visible on page load. (Also note that this happens while using the dbc.Tab(s)).

Also note that if you press the drop-down button, then the correct date is filled in and also focuses the calander on the correct date. So it is mostly a visual bug. As a temporary hotfix you can have a callback listening to the tab and then apply the input date to the output date, this hotfixes the problem, but is not elegant

Expected behavior

The date should be visibile in the datepicker

Reproducing code

from dash import Dash, dcc, html
import dash_bootstrap_components as dbc

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

app.layout = dbc.Container(
    [
        dbc.Tabs(
            id="tabs",
            active_tab="tab-home",
            children=[
                dbc.Tab(
                    label="Home",
                    tab_id="tab-home",
                    children=html.Div(
                        [
                            "Home is active on page load.",
                            dcc.DatePickerSingle(
                                id="working-date-picker",
                                date="2026-02-24", # This datepicker correctly shows the correct date as this tab was visible on page-load
                            ),
                        ],
                    ),
                ),
                dbc.Tab(
                    label="Date tab",
                    tab_id="tab-date",
                    children=html.Div(
                        [
                            html.Div(
                                "DatePickerSingle is in this tab (not active initially)."
                            ),
                            dcc.DatePickerSingle(
                                id="not-working-datepicker",
                                date="2026-02-24", # Datepicker has visual glitch, the selected date is not visible if switched to this tab
                            ),
                        ]
                    ),
                ),
            ],
        ),
    ],
    fluid=True,
)

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

Thank you for the amazing work ❤️

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions