diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d5986c457..cfb27c8d71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/). - [#2898](https://github.com/plotly/dash/pull/2898) Fix error thrown when using non-existent components in callback running keyword. Fixes [#2897](https://github.com/plotly/dash/issues/2897). - [#2892](https://github.com/plotly/dash/pull/2860) Fix ensures dcc.Dropdown menu maxHeight option works with Datatable. Fixes [#2529](https://github.com/plotly/dash/issues/2529) [#2225](https://github.com/plotly/dash/issues/2225) - [#2896](https://github.com/plotly/dash/pull/2896) The tabIndex parameter of Div can accept number or string type. Fixes [#2891](https://github.com/plotly/dash/issues/2891) +- [#2900](https://github.com/plotly/dash/pull/2900) Allow strings in layout list. Fixes [#2890](https://github.com/plotly/dash/issues/2890) - [#2908](https://github.com/plotly/dash/pull/2908) Fix when environment variables are ignored by Dash.run() at runtime. Fixes [#2902](https://github.com/plotly/dash/issues/2902) ## [2.17.1] - 2024-06-12 diff --git a/dash/_validate.py b/dash/_validate.py index b5e21d9eb5..a26fd0f73b 100644 --- a/dash/_validate.py +++ b/dash/_validate.py @@ -439,11 +439,13 @@ def _validate_id(comp): if isinstance(layout_value, (list, tuple)): for component in layout_value: + if isinstance(component, (str,)): + continue if isinstance(component, (Component,)): _validate(component) else: raise exceptions.NoLayoutException( - "List of components as layout must be a list of components only." + "Only strings and components are allowed in a list layout." ) else: _validate(layout_value) diff --git a/tests/integration/test_integration.py b/tests/integration/test_integration.py index 14bd018027..47010bd319 100644 --- a/tests/integration/test_integration.py +++ b/tests/integration/test_integration.py @@ -433,6 +433,8 @@ def test_inin028_layout_as_list(dash_duo): app = Dash() app.layout = [ + "string1", + "string2", html.Div("one", id="one"), html.Div("two", id="two"), html.Button("direct", id="direct"), @@ -458,6 +460,9 @@ def on_nested_click(n_clicks): dash_duo.start_server(app) + dash_duo.wait_for_contains_text("#react-entry-point", "string1") + dash_duo.wait_for_contains_text("#react-entry-point", "string2") + dash_duo.wait_for_text_to_equal("#one", "one") dash_duo.wait_for_text_to_equal("#two", "two")