quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.77k stars 308 forks source link

Sidebar in Dashboard not toggleable anymore with `{bslib}` value box #9454

Open AlbertRapp opened 4 months ago

AlbertRapp commented 4 months ago

Bug description

I used bslib::value_box() to add a value box to a Quarto dashboard due to better customizability (see also #9453). But this means sidebars cannot be toggled anymore after adding the value box. My guess is that something about the value box's full screen mode (that is available in the Quarto dashboard even though this option is set to FALSE) prevents the moving in and out of the sidebar. But this is just a hunch.

Steps to reproduce


---
format: dashboard
---

# Page 1

## {.sidebar}

This sidebar is not toggleable anymore

## Main body

### Value box

```{r}
bslib::value_box(
  'Adelie penguins',
  theme = "danger",
  value = 23432,
  full_screen = FALSE ## This is nevertheless possible in the dashboard 
)

### Expected behavior

Sidebar moves in and out after clicking on the arrow thingy

### Actual behavior

Side doesn't move

### Your environment

IDE: RStudio 2023.12.1 Build 402
OS: Ubuntu 22.04.4 LTS

### Quarto check output

```bash
Quarto 1.4.526
[✓] Checking versions of quarto binary dependencies...
      Pandoc version 3.1.9: OK
      Dart Sass version 1.69.5: OK
      Deno version 1.37.2: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
      Version: 1.4.526
      Path: /opt/quarto/bin

[✓] Checking tools....................OK
      TinyTeX: v2024.03
      Chromium: (not installed)

[✓] Checking LaTeX....................OK
      Using: TinyTex
      Path: /home/albert/.TinyTeX/bin/x86_64-linux
      Version: 2023

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.11.5 (Conda)
      Path: /home/albert/anaconda3/bin/python
      Jupyter: 5.3.0
      Kernels: python3

[✓] Checking Jupyter engine render....OK

[✓] Checking R installation...........OK
      Version: 4.3.3
      Path: /usr/lib/R
      LibPaths:
        - /home/albert/R/x86_64-pc-linux-gnu-library/4.3
        - /usr/local/lib/R/site-library
        - /usr/lib/R/site-library
        - /usr/lib/R/library
      knitr: 1.45
      rmarkdown: 2.25

[✓] Checking Knitr engine render......OK
mcanouil commented 4 months ago

Could you try with at least the latest stable version? You are a little bit behind, i.e., the current is 1.4.553 (1.4.526 was a pre-release from last December). 1.4 stable was released on the 15th of February (1.4.550)

(In current 1.5 pre-release, there are no changes made regarding Dashboard.)

AlbertRapp commented 4 months ago

Oh my bad I thought my system auto-updates. In any case I tried this now with v.1.4.554 and the issue still persists.

gadenbuie commented 4 months ago

@AlbertRapp The main issue here is that Quarto already includes a version of bslib's component dependencies. Adding a bslib::value_box() brings in bslib's component dependency, which ultimately makes different assumptions about usage and available resources on the page. I opened an issue in bslib to mitigate some of these problems.

For now, I'd recommend sticking with Quarto's native versions of bslib-related components or to use bslib to emit the markup without the dependency. The easiest way to do that is to cast the bslib component to and HTML character string, e.g.

bslib::value_box(
  'Adelie penguins',
  theme = "bg-gradient-blue-red",
  value = 23432,
  full_screen = FALSE ## Quarto still makes its own decision about this
) |> 
  format() |> 
  htmltools::HTML()
AlbertRapp commented 4 months ago

Nice! That's a fantastic work-around. Thank you @gadenbuie.

gadenbuie commented 4 months ago

You're welcome! After rstudio/bslib#1045 this workaround won't be required, although there may be unexpected behavior if bslib and Quarto's implementations drift.