Consider making page_fillable truly filling the entire page
daattali opened this issue · 2 comments
I just tried using page_fillable()
and was surprised to see that it does not in fact fill the page. Judging by the name of the function, this seems odd.
Here's an example of why the behaviour is just not unintuitive but also has consequences. I was previously using a shiny app that can be reduced to this:
library(shiny)
ui <- fillPage(
leaflet::leaflet(),
absolutePanel("test", top = 0, right = 0)
)
server <- function(input, output, session) {}
shinyApp(ui, server)
I wanted to try to upgrade to bs5, so I used the drop-in replacement of bslib::page_fillable()
instead of fillPage()
. This resulted in extra whitespace on all sides:
This means that I now have to update my code and fix all my css positions, or add padding=0
to the page params. Even if I do that, there's still whitespace at the bottom of the page, which can only be fixed by also adding gap=0
. So a truly fillable page can really be achieved with page_fillable(padding = 0, gap = 0, ...)
. I'm wondering why this decision was made and whether it can be changed to have 0 whitespace by default.
Hi Dean, I can certainly see that page_fillable()
might be unintuitive if you were expecting it to be a drop-in replacement for fillPage()
. If this claim is made somewhere, please let us know. I searched through bslib's docs and didn't see any comparisons with fillPage()
.
I'm wondering why this decision was made and whether it can be changed to have 0 whitespace by default.
page_fillable()
's gap
and padding
arguments are consistent with other layout functions in bslib that support fillable layouts. In addition to being internally consistent, the current padding and gap settings cover the majority of layouts that use page_fillable()
. In cases where you want a single item to span the full page width and height, setting padding = 0
should be sufficient.
Even if I do that, there's still whitespace at the bottom of the page, which can only be fixed by also adding
gap=0
.
This shouldn't be the case, or at least it's not demonstrated by your reprex (example on shinylive).
If you needed to include gap = 0
to remove spacing from the bottom of the page, it's likely that you have an empty element adjacent to the leaflet map. page_fillable()
uses display: flex
and empty elements in flexbox still receive gap. That's unfortunate, but you can either move the empty element somewhere else in the DOM or use CSS to hide empty elements in .bslib-page-fill
:
.bslib-page-fill > :empty {
display: none
}
Thanks for the feedback! I'm going to close this issue because we don't have plans to change the default values of padding
and gap
in page_fillable()
, but we're happy to keep discussing if you have questions or thoughts.