rstudio/bslib

layout_sidebar: second scrollbar appears when opening a long dropdown menu

Closed this issue · 2 comments

I saw the issue here first.

Not sure if this is intended (or this rather is a {shinyWidgets} issue), however, currently when opening a long dropdown menu in the sidebar a second scrollbar appears:

image

Example app:

library(shiny)
library(bslib)
library(shinyWidgets)

ui <- page_fillable(
  layout_sidebar(
    sidebar = sidebar(
      pickerInput("a", label = "Select", choices = 1:50),
      pickerInput("b", label = "Select", choices = 1:50),
      pickerInput("c", label = "Select", choices = 1:50),
      pickerInput("d", label = "Select", choices = 1:50)
    )
  )
  
)

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

shinyApp(ui, server)

I don't think Shiny or bslib is controlling the height of the dropdown box. That's being controlled by the dropdown component used by shinyWidgets, where it's limited to the height of the parent container (but with JavaScript, taking into account the position of the dropdown button). Given the constraints of this problem, it's a very reasonable approach.

If there's anything to do be done, it would likely involve convincing the dropdown box not to overflow the sidebar container, which might take some padding or margin on the bottom edge. Or there may be other settings in the dropbox library that can be used to position the dropdown box outside of the sidebar container in the DOM so that it's not affected by the overflow behavior of the sidebar.

I know the double scrollbar isn't ideal but it's a very sensible choice by both libraries in this situation. shinyWidgets might be able to remedy it but I don't think there's anything we can do in bslib. I'd be happy to revisit this if further investigation leads to concrete suggestions!

This issue has been automatically locked. If you have found a related problem, please open a new issue (with a reproducible example or feature request) and link to this issue.
🙋 Need help? Connect with us on Discord or Posit Community.