rstudio / rstudio/bslib

`layout_column_wrap()` element heights on mobile

Open
#951 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

layout_column_wrap() has three arguments for controlling height:

  • height sets the height of the entire layout
  • height_mobile sets the height of the entire layout on mobile devices
  • heights_equal determines if every element in the grid will have the same height.

What's odd about height and height_mobile is that they apply to the entire layout_column_wrap() layout, whereas the width argument applies to each item.

(The documentation also uses the word card to refer to items in the layout in both width and height.)

Furthermore, on mobile devices, when heights_equal = "all" (the default), we keep the grid-auto-rows: 1fr property on mobile as well, which can lead to odd spacing between elements because each item is given the same space as the tallest item in the layout.

Some options:

  • We could unset grid-auto-rows for mobile screen sizes,
  • We could add an argument heights_equal_mobile = "row",
  • or we could do a better job of calling out how this argument relates to mobile sized layouts.

Here's an example app:

library(shiny)
library(bslib)
library(htmltools)

ui <- page_fixed(
  layout_column_wrap(
    div(class = "bg-primary", style = css(height = "300px")),
    div(class = "bg-secondary", style = css(height = "400px")),
    div(class = "bg-danger", style = css(height = "500px"))
  )
)

server <- function(input, output, session) {

}

shinyApp(ui, server)
Desktop Mobile
image image

With heights_equal = "row", this layout looks like this.

Desktop Mobile
image image

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the layout_column_wrap() entry point and the documented height, height_mobile, and heights_equal arguments; inspect how grid-auto-rows behaves across desktop and mobile sizes. Compare the example app and screenshots, then define the intended mobile behavior before updating the implementation and any related documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, scss
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.