Skip to content

as_fillable_container() and as_fill_item() should append fillability classes #865

@gadenbuie

Description

@gadenbuie

Currently, ui.fill.as_fillable_container() and ui.fill.as_fill_item() prepend the fill/fillable classes to the modified element's class list.

from shiny import ui
from htmltools import div

ui.fill.as_fill_item(div(class_="my-item"))
#> <div class="html-fill-item my-item"></div>
ui.fill.as_fillable_container(div(class_="my-container"))
#> <div class="html-fill-container my-container"></div>

As utility classes, these classes should be appended rather the prepended. In CSS the final styles are not impacted by the order of the classes in the class attribute. So this recommendation is a stylistic decision but important for debugging -- most often the first classes carry the most signal, e.g. bslib-grid or bslib-sidebar-layout, and it's much easier to debug markup in the browser when they appear first in the classlist.

from shiny import ui
from htmltools import div

ui.fill.as_fill_item(div(class_="my-item"))
#> <div class="my-item html-fill-item"></div>
ui.fill.as_fillable_container(div(class_="my-container"))
#> <div class="my-container html-fill-container"></div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions