diff --git a/NEWS.md b/NEWS.md index 628fbaaf..2cec56de 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # htmltools (development version) +* Empty Shiny text and UI outputs are now hidden by default in fillable containers. (#435) + # htmltools 0.5.8 ## Improvements diff --git a/inst/fill/fill.css b/inst/fill/fill.css index 841ea9d5..bf186811 100644 --- a/inst/fill/fill.css +++ b/inst/fill/fill.css @@ -2,14 +2,14 @@ .html-fill-container { display: flex; flex-direction: column; - /* Prevent the container from expanding vertically or horizontally beyond its - parent's constraints. */ + /* Prevent the container from expanding vertically or horizontally beyond + * its parent's constraints. */ min-height: 0; min-width: 0; } .html-fill-container > .html-fill-item { - /* Fill items can grow and shrink freely within - available vertical space in fillable container */ + /* Fill items can grow and shrink freely within available vertical space in + * fillable container */ flex: 1 1 auto; min-height: 0; min-width: 0; @@ -18,4 +18,10 @@ /* Prevent shrinking or growing of non-fill items */ flex: 0 0 auto; } + .html-fill-container > .shiny-html-output:empty, + .html-fill-container > .shiny-text-output:empty { + /* Remove empty ui and text outputs from the document flow so that extra + * space in the flex container is not allocated for them. */ + position: absolute + } }