The problem with this approach is that if --_sidebar-fg is set on a parent of .bslib-sidebar-layout, the "inherit" in .bslib-sidebar-layout means inherit the _value of --_sidebar-fg_ and is evaluated in that context rather than being evaluated as inherit inside of .sidebar { color: inherit }.
The result was that if a parent sidebar layout uses fg of white, that value would end up passing down to an inner sidebar layout.
The new approach simply resets --_sidebar-fg: var(--bslib-sidebar-fg) at each .bslib-sidebar-layout. This way, outer sidebar layouts don't affect inner sidebar layouts, unless globally via --bslib-sidebar-fg.
Fixes an issue introduced by https://github.com/rstudio/bslib/pull/1056
We were using this CSS:
The problem with this approach is that if
--_sidebar-fg
is set on a parent of.bslib-sidebar-layout
, the"inherit"
in.bslib-sidebar-layout
means inherit the _value of--_sidebar-fg
_ and is evaluated in that context rather than being evaluated asinherit
inside of.sidebar { color: inherit }
.The result was that if a parent sidebar layout uses fg of white, that value would end up passing down to an inner sidebar layout.
The new approach simply resets
--_sidebar-fg: var(--bslib-sidebar-fg)
at each.bslib-sidebar-layout
. This way, outer sidebar layouts don't affect inner sidebar layouts, unless globally via--bslib-sidebar-fg
.This issue is demonstrated in the second tab of
308-sidebar-kitchen-sink
and was found in this run: https://github.com/rstudio/shinycoreci/tree/gha-bea44a3-2024_05_31_05_04-4.4-macOS/inst/apps/308-sidebar-kitchen-sink/tests/testthat/_snaps/mac-4.4/308-sidebar-kitchen-sink.