Open ismirsehregal opened 1 year ago
I can replicate this on my Firefox+Mac, and upon a bit of digging, this is the result of a known "feature" specific to Firefox.
Most of the advice surrounding this seems to be set autocomplete="off"
on <input>
(or <form>
), which does indeed work for radioButtons()
and checkboxGroupInput()
, but not for selectInput()
(I'm not sure why).
library(shiny)
autoCompleteOff <- function(x) {
tagAppendAttributes(x, .cssSelector = "input", autocomplete = "off")
}
ui <- fluidPage(
selectInput("select", "Values", LETTERS[1:5], selected='A') |>
autoCompleteOff(),
radioButtons("radio", "Radio", LETTERS[1:5], selected='A') |>
autoCompleteOff(),
checkboxGroupInput("check", "Checkbox", LETTERS[1:5], selected='A') |>
autoCompleteOff()
)
server <- function(input, output) {
}
shinyApp(ui = ui, server = server)
As it turns out though, if you hold shift during refresh, the inputs will go back to their original state (regardless of whether autcomplete="off"
is set).
I don't really know if this is possible, but maybe one could detect a refresh via beforeunload
, and either force a shift+refresh
, or present a dialog about it.
Ooof, annoying. Does the server "see" the same values as the UI, at least?
@jcheng5 yes, the latest user input is also restored on the server side.
This is the same as #2293. There are a couple of useful links to references in that issue.
Shiny (latest CRAN version) inputs are restored after pressing the reload button in firefox 108.0.1 (64-bit) on Windows 10.
Expected behaviour:
This is the case in chrome.
Example coming from here: