My shinyApp has lots of input options in the sidebar that go well below the screen height and the user access them after scrolling. One of the last options at the bottom of the scrolling is a fileInput widget. When one clicks on it, the page automatically jumps to the top of the sidebar right before the file browser opens.
Is there a way to avoid that automatic scrolling/jump?
I'm using Shiny v 1.7.1. I'm not 100% sure, but I think this was not the behavior of fileInput in past versions of Shiny (?).
This is an example of what happens in my case, but limited to 500 px for simplicity. Just imagine a much longer list of input options with different widgets.
ui <- fluidPage(
sidebarLayout(
sidebarPanel(
width = 4,
style = "height: 500px; overflow-y: scroll;",
fileInput("file1", "Choose file 1"),
fileInput("file2", "Choose file 2"),
fileInput("file3", "Choose file 3"),
fileInput("file4", "Choose file 4"),
fileInput("file5", "Choose file 5"),
fileInput("file6", "Choose file 6"),
fileInput("file7", "Choose file 7"),
),
mainPanel(
# something very interesting is shown here
)
)
)
server <- function(input, output) {
# something very interesting is done here
}
shinyApp(ui, server)