From 28cc62d3975b2b13fe0c11dda7b9702805b06fa5 Mon Sep 17 00:00:00 2001 From: Carson Date: Wed, 6 Dec 2023 17:03:12 -0600 Subject: [PATCH] Close #860. Make sure the fill HTML depdendency comes for the ride with page_fillable() --- shiny/ui/_page.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/shiny/ui/_page.py b/shiny/ui/_page.py index 98eee94cd..3c373aaee 100644 --- a/shiny/ui/_page.py +++ b/shiny/ui/_page.py @@ -36,7 +36,7 @@ from ._tag import consolidate_attrs from ._utils import get_window_title from .css import CssUnit, as_css_padding, as_css_unit -from .fill._fill import FILLABLE_CONTAINTER_ATTRS +from .fill._fill import as_fillable_container def page_sidebar( @@ -298,13 +298,8 @@ def page_fillable( style = css(padding=as_css_padding(padding), gap=as_css_unit(gap)) - return page_bootstrap( + page = page_bootstrap( head_content(tags.style("html { height: 100%; }")), - # Even though page_bootstrap accepts *args/**kwargs, we need to prepend the - # class value to the tags.body. To avoid having a within a for a - # core code path, we can manually use `FILLABLE_CONTAINER_ATTRS` here as the - # first set of attributes. - FILLABLE_CONTAINTER_ATTRS, {"class": "bslib-page-fill bslib-gap-spacing", "style": style}, {"class": "bslib-flow-mobile"} if fillable_mobile else None, attrs, @@ -314,6 +309,15 @@ def page_fillable( lang=lang, ) + # page returns a tag, but we need to make the fillable + body = page.children[1] + if not isinstance(body, Tag) or body.name != "body": + raise ValueError("Expected a tag") + + as_fillable_container(body) + + return page + @add_example() def page_fluid(