rstudio / shiny

Easy interactive web applications with R
https://shiny.posit.co/
Other
5.37k stars 1.86k forks source link

`sliderInput()`, once set at a single value in the middle of a range, cannot be pulled both left and right, but only the way opposite to that used to pull the slider into a single value #3778

Open asadow opened 1 year ago

asadow commented 1 year ago

Hopefully the title makes sense. I recommend to just try it.

sliderInput( inputId = "year", label = "Choose years", step = 1, sep = "", min = 2014, max = 2022, value = c(2014, 2022) )

ismirsehregal commented 1 year ago

To me this behaviour makes sense. You can only move the slider which is covering the other one. What is your expected behaviour?

library(shiny)

ui <- fluidPage(
  sliderInput(
    inputId = "year",
    label = "Choose years",
    step = 1,
    sep = "",
    min = 2014,
    max = 2022,
    value = c(2014, 2022)
  )
)

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

shinyApp(ui, server)
asadow commented 1 year ago

It does not look like a slider is covering the other one, hence I would expect you can pull either way.

daattali commented 1 year ago

I personally think that the current behaviour feels correct and intuitive, but I checked what else is out there.

From a quick search it seems like the shiny behaviour is also the standard behaviour for other sliders. Here's the first three double-sided sliders I found using google, and all of them work the same way; if you drag one end over the other, then only this end will be moveable. And there's no special visual indication that they overlap.

https://jqueryui.com/slider/#range

https://refreshless.com/nouislider/

https://codepen.io/predragdavidovic/pen/mdpMoWo

asadow commented 1 year ago

I disagree for 2 reasons. Once a slider covers the other one, 1) there's no indication of which slider is covering which, 2) nor that it is a range input, as opposed to a single value slider.

ismirsehregal commented 1 month ago

related: https://github.com/IonDen/ion.rangeSlider/issues/554