bookdown icon indicating copy to clipboard operation
bookdown copied to clipboard

[FR] Re-visiting #1250: boolean to control collapsed navbar

Open walkerke opened this issue 3 years ago • 0 comments

Starting this new issue at the request of @cderv -

@Pindar777 in issue #1250 requested the ability to have the third column navigation bar in a bs4_book expanded to show all H3 headings by default, as this appears nicer when printed. This issue was solved with the new version of bslib (0.3.0) which uses bootstrap 4.6.0 and includes the following CSS not found in bootstrap 4.5.3:

  .nav:not(.nav-stacked):not(.flex-column) {
    float: none !important
  }
  .nav:not(.nav-stacked):not(.flex-column)>.bslib-nav-spacer {
    margin-left: auto !important
  }
  .nav:not(.nav-stacked):not(.flex-column)>.form-inline {
    margin-top: auto;
    margin-bottom: auto
  }  

For my purposes (and others with whom I have spoken about this), the old behavior is preferable, especially for chapters that include a lot of H3 headers. For example, here is a chapter from my book the old way, where only the active H2 is expanded on the right-hand side:

image

Here is the same chapter the new way, which expands every H2 header by default, making the view messier (in my opinion):

image

I've fixed the problem temporarily by rolling back to bslib version 0.2.4, which defaults to the older Bootstrap version. Another solution would be to remove the new CSS section manually. However, this isn't likely to be a stable solution longer-term as authors will want to take advantage of new features in bslib and Bootstrap. I've tagged this as a feature request if you all think this would be a priority to solve. If not - does anyone know of a quick solution that already exists that non-CSS experts like me could take advantage of?

Thank you!

walkerke avatar Oct 12 '21 19:10 walkerke