ramnathv / htmlwidgets

HTML Widgets for R
http://htmlwidgets.org
Other
792 stars 206 forks source link

could toHTML handle !important on height and width? #412

Open MilesMcBain opened 3 years ago

MilesMcBain commented 3 years ago

At the moment we can't instantiate a htmlwidget with inline CSS for height and width that uses the !important override. This will fail in htmltools::validateCssUnit.

This would come in handy to override framework assumptions about how to size our widgets. An example of this is {flexdashboard} which imposes height = 100% !important https://github.com/rstudio/flexdashboard/issues/351. This has created a problem for me with a htmlwidget that is a set of controls, not a visualisation.

{flexdashboard} should probably not be doing this, but allowing !important to be used on the widget's inline CSS would allow us to easily skirt this issue wherever it occurs.

cpsievert commented 2 years ago

That makes sense that htmltools::validateCssUnit() should be able to handle !important. I filed an issue here https://github.com/rstudio/htmltools/issues/328