shiny icon indicating copy to clipboard operation
shiny copied to clipboard

`dateInput()`'s popup is incorrectly positioned when using bootstrap 5 top margin on parent container

Open kennedymwavu opened this issue 1 year ago • 2 comments

Without any top margin on parent div, the calendar popup displays well:

library(shiny)

ui <- bslib::page(
  theme = bslib::bs_theme(version = 5, preset = "bootstrap"),
  tags$div(
    dateInput(inputId = "mydate", label = "My date")
  )
)

server <- \(input, output, session) {}

shinyApp(ui, server)

image

But when you add a top margin to the parent div, the popup displays over the input:

library(shiny)

ui <- bslib::page(
  theme = bslib::bs_theme(version = 5, preset = "bootstrap"),
  tags$div(
    class = "mt-5", # add top margin
    dateInput(inputId = "mydate", label = "My date")
  )
)

server <- \(input, output, session) {}

shinyApp(ui, server)

image

kennedymwavu avatar Jun 06 '24 14:06 kennedymwavu

Interesting, thanks! FWIW, I think this achieves what you're looking for?

bslib::page(
    theme = bslib::bs_theme(version = 5, preset = "bootstrap"),
    tags$div(class = "pt-5"),
    dateInput(inputId = "mydate", label = "My date")
)

cpsievert avatar Jun 06 '24 15:06 cpsievert

Yes, using padding works well.

kennedymwavu avatar Jun 06 '24 16:06 kennedymwavu