I have:
Bug description
In a format: dashboard document, a cell that outputs a bslib component such as bslib::value_box() shows an "Expand" (full-screen) button in the bottom-right corner even when the cell sets #| expandable: false. A Quarto-native value box, or a plain plot(), correctly honours the option and shows no button.
Reported in discussion #14714. Root cause traced below.
Steps to reproduce
---
format: dashboard
---
## Column
```{r}
#| expandable: false
bslib::value_box(title = "x", value = 1, theme = "primary")
```
Actual behavior
The value box renders with an "Expand" button; #| expandable: false has no effect.
Root cause (against v1.9.38, SHA 6ebb5db80eb542ac76189c3d7c33ae6f654b93d2):
-
When a cell outputs raw bslib- HTML, dashboard.lua captures it into bslibRawOutputs and re-emits it "unharmed". The cell's card options are read via readOptions(el)/makeCard(...) but applied only to the remaining non-bslib content, so #| expandable: false never reaches the value box and no data-expandable attribute is emitted on it.
|
if #bslibRawOutputs > 0 then |
|
-- If bslib outputs were detected, we need to elevate those rawblocks and |
|
-- just allow them to pass through the system unharmed along side |
|
-- the cell and any of its other output |
|
local result = pandoc.Blocks(bslibRawOutputs) |
|
if el ~= nil and #el.content > 0 then |
|
local options, userClasses = dashboard.card.readOptions(el) |
|
local card = dashboard.card.makeCard(el.content, userClasses, options) |
|
if card ~= nil then |
|
result:insert(card) |
|
end |
|
end |
|
return result |
-
In HTML post-processing, processCards handles every .card, including the bslib value box. With no data-expandable attribute present, defaultValue decides: it suppresses the button only for elements with Quarto's own class kValueboxClass ("valuebox") or a flow layout. A bslib value box uses bslib-value-box, so the check misses and the fallback returns dashboardMeta.expandable, which defaults to true, injecting Quarto's own Expand button (kExpandBtnHtml).
|
attr: kAttrExpandable, |
|
handle: (el: Element, attrValue: string) => { |
|
if (attrValue !== "false") { |
|
const shellEl = doc.createElement("DIV"); |
|
shellEl.innerHTML = kExpandBtnHtml; |
|
for (const childEl of shellEl.children) { |
|
el.appendChild(childEl); |
|
} |
|
el.setAttribute(kAttrFullScreen, "false"); |
|
} |
|
}, |
|
defaultValue: (el: Element) => { |
|
if (el.classList.contains(kValueboxClass) || hasFlowLayout(el)) { |
|
return "false"; |
|
} else { |
|
return dashboardMeta.expandable ? "true" : "false"; |
|
} |
|
}, |
|
}, |
|
{ |
|
export const kValueboxClass = "valuebox"; |
Because the button is Quarto's, passing full_screen = FALSE to bslib::value_box() does not remove it.
Expected behavior
#| expandable: false on a cell that outputs a bslib::value_box() (or any bslib card) should suppress the Expand button, matching the behaviour of Quarto-native value boxes.
Your environment
- OS: Ubuntu 24.04
bslib: 0.11.0.9000
(Environment as reported in discussion #14714.)
Quarto check output
Quarto 1.9.38 (as reported in discussion #14714). Root cause verified against source at tag v1.9.38 and reproduces on main. Full quarto check output was not provided by the original reporter.
I have:
Bug description
In a
format: dashboarddocument, a cell that outputs abslibcomponent such asbslib::value_box()shows an "Expand" (full-screen) button in the bottom-right corner even when the cell sets#| expandable: false. A Quarto-native value box, or a plainplot(), correctly honours the option and shows no button.Reported in discussion #14714. Root cause traced below.
Steps to reproduce
Actual behavior
The value box renders with an "Expand" button;
#| expandable: falsehas no effect.Root cause (against
v1.9.38, SHA6ebb5db80eb542ac76189c3d7c33ae6f654b93d2):When a cell outputs raw
bslib-HTML,dashboard.luacaptures it intobslibRawOutputsand re-emits it "unharmed". The cell's card options are read viareadOptions(el)/makeCard(...)but applied only to the remaining non-bslibcontent, so#| expandable: falsenever reaches the value box and nodata-expandableattribute is emitted on it.quarto-cli/src/resources/filters/quarto-post/dashboard.lua
Lines 292 to 304 in 6ebb5db
In HTML post-processing,
processCardshandles every.card, including thebslibvalue box. With nodata-expandableattribute present,defaultValuedecides: it suppresses the button only for elements with Quarto's own classkValueboxClass("valuebox") or a flow layout. Abslibvalue box usesbslib-value-box, so the check misses and the fallback returnsdashboardMeta.expandable, which defaults totrue, injecting Quarto's own Expand button (kExpandBtnHtml).quarto-cli/src/format/dashboard/format-dashboard-card.ts
Lines 82 to 101 in 6ebb5db
quarto-cli/src/format/dashboard/format-dashboard-shared.ts
Line 53 in 6ebb5db
Because the button is Quarto's, passing
full_screen = FALSEtobslib::value_box()does not remove it.Expected behavior
#| expandable: falseon a cell that outputs abslib::value_box()(or anybslibcard) should suppress the Expand button, matching the behaviour of Quarto-native value boxes.Your environment
bslib: 0.11.0.9000(Environment as reported in discussion #14714.)
Quarto check output
Quarto 1.9.38 (as reported in discussion #14714). Root cause verified against source at tag
v1.9.38and reproduces onmain. Fullquarto checkoutput was not provided by the original reporter.