diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e7da2d67..8f8748f92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Bug fixes * Fixed `input_task_button` not working in a Shiny module. (#1108) - +* Fixed several issues with `page_navbar()` styling. (#1124) ## [0.7.1] - 2024-02-05 diff --git a/shiny/ui/_navs.py b/shiny/ui/_navs.py index 88c7d5f31..9bdeaea52 100644 --- a/shiny/ui/_navs.py +++ b/shiny/ui/_navs.py @@ -1060,12 +1060,12 @@ def layout(self, nav: Tag, content: Tag) -> TagList: if self.position != "static-top": nav_final.add_class(self.position) - nav_final.add_class(f"navbar-{'dark' if self.inverse else 'light'}") + # bslib supports navbar-default/navbar-inverse (which is no longer + # a thing in Bootstrap 5) in a way that's still useful, especially Bootswatch. + nav_final.add_class(f"navbar-{'inverse' if self.inverse else 'default'}") if self.bg: - nav_final.attrs["style"] = "background-color: " + self.bg - else: - nav_final.add_class(f"bg-{'dark' if self.inverse else 'light'}") + nav_final.add_style(f"background-color: {self.bg} !important;") content = _make_tabs_fillable( content, diff --git a/tests/pytest/test_navs.py b/tests/pytest/test_navs.py index 661311948..34d6edc97 100644 --- a/tests/pytest/test_navs.py +++ b/tests/pytest/test_navs.py @@ -143,7 +143,7 @@ def test_nav_markup(): assert TagList(x).render()["html"] == textwrap.dedent( """\ -