rstudio / htmltools

Tools for HTML generation and output
https://rstudio.github.io/htmltools/
213 stars 67 forks source link

feat(html-fill-container): Set min width and height instead of overflow auto #387

Closed gadenbuie closed 12 months ago

gadenbuie commented 12 months ago

Fixes #386

This PR replaces overflow: auto on fillable containers (i.e. .html-fill-container) with min-width: 0 and min-height: 0. This causes the fillable flex container to resize its contents (in particular to shrink them) correctly without clipping the child container. (See the discussion and reprex in #386.)

Reprex ```r library(htmltools) library(bslib) page_fixed( bindFillRole( container = TRUE, div( class = "m-3 float-left", style = css(height = "300px", width = "300px"), bindFillRole( div(class = "border border-2 shadow"), item = TRUE ) ) ), bindFillRole( container = TRUE, div( # class = "overflow-visible", class = "m-3 float-left", style = css(height = "300px", width = "300px"), bindFillRole( div(class = "border border-2 shadow"), item = TRUE ) ) ) ) ```

image

Note that we retain overflow: auto on .html-fill-item, which means that elements within a fillable item will still cause scrolling, e.g long select input choice menus.