Skip to content

SelectizeInput highlight issue #2957

Closed

Description

@petervdberg

If I create a selectizeInput with repeating characters in a choice value (in the example "aa aa"), and search for the entire choice value (by clicking the selectize, hitting backspace and type), the highlight functionality seems to break the dropdown, and shows the choice only partially (in the example "a")

selectizeInput

selectInput("x", NULL, choices = c("aa aa"))

Activity

  1. added
    UI toolkit: selectInput
    on Aug 18, 2020
  2. leonawicz commented on Sep 22, 2020

    @leonawicz

    Whether single- or multi-select, I can reproduce this with any set of choices. There does not need to be repeating text within a choice.

    selectInput("x", NULL, c("aba", "abb", "abc"), multiple = TRUE)

    Type ab ab. Or type ab a and hit space again. Or a ab. Values don't seem to change, but all choices in client-side display becomes truncated based on the character match when anything is repeated as you type. I don't know the source of this or what version of shiny or selectize it may have crept in but it makes choice lists with any somewhat repetitive multi-word phrases unusable.

  3. leonawicz commented on Sep 22, 2020

    @leonawicz

    Going with the tagged releases, I have to revert back to shiny v1.1.0 to see the problem go away. It occurs from 1.2.0 onward.

    Interestingly, the issue where the yellow highlighting gets stuck on options text after you clear or make selections also goes away prior to v1.2.0.

    But perhaps this is related to an included version of selectize.js. I don't have time to dig further. But reverting back to shiny 1.1 is too much of a rollback imo to get around this issue unfortunately.

  4. wch commented on Sep 22, 2020

    @wch
    Collaborator

    A reproducible example:

    library(shiny)
    shinyApp(
      ui = fluidPage(
        selectInput("x", NULL, c("aba", "abb", "abc"), multiple = TRUE)
      ),
      server = function(input, output) {}
    )
  5. wch commented on Sep 22, 2020

    @wch
    Collaborator

    I've bisected it to 6b60580, where we upgraded to Selectize 0.12.4.

    That also appears to be the latest official release. There are subsequent versions, 0.12.5 and 0.12.6, but those aren't tagged as releases.

  6. leonawicz commented on Sep 22, 2020

    @leonawicz

    I can confirm using inlcudeScript() in ui.R to load a copy of v0.12.1 after 0.12.4 is a sufficient workaround for the problem if it's needed immediately.

  7. leonawicz commented on Jan 27, 2021

    @leonawicz

    Just want to update that this is still an issue, but the temporary workaround I noted above of overriding with selectize.js v0.12.1 will no longer work with Shiny v1.6.0, requiring to stay on Shiny 1.5.0. (You will get a JS error because selectize-plugin-a11y won't be found.)

    Therefore the choice is to stick to Shiny 1.5.0 or to accept the above selectize behavior.

    Unfortunately this issue of text being stripped from menu items as you type in the search box is an easy problem to encounter especially for sizable lists with options that are similar, contain multiple space-delimited words, etc. Users find it jarring and there is pressure to not update Shiny beyond 1.5 as a result.

  8. added this to the 1.7 milestone on Feb 1, 2021
  9. ngiangre commented on Sep 7, 2021

    @ngiangre

    I also have this issue. I can reproduce it at this site https://shiny.rstudio.com/gallery/selectize-examples.html. Type 'al al' in the second input. Reverting back to shiny_1.5.0 does not fix this behavior for me though. Any advice for a workaround would be appreciated!

    > sessionInfo()
    R version 4.0.3 (2020-10-10)
    Platform: x86_64-apple-darwin17.0 (64-bit)
    Running under: macOS Big Sur 10.16
    
    Matrix products: default
    LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib
    
    locale:
    [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
    
    attached base packages:
    [1] stats     graphics  grDevices utils     datasets  methods   base     
    
    other attached packages:
     [1] htmltools_0.5.2      shinyjs_2.0.0        shinyjqui_0.4.0      shinybusy_0.2.2      cowplot_1.1.1       
     [6] pool_0.1.6.9000      data.table_1.14.0    forcats_0.5.1        stringr_1.4.0        dplyr_1.0.7         
    [11] purrr_0.3.4          readr_2.0.1          tidyr_1.1.3          tibble_3.1.4         ggplot2_3.3.5       
    [16] tidyverse_1.3.1      DT_0.19              shinydashboard_0.7.1 shiny_1.5.0         
    
    loaded via a namespace (and not attached):
     [1] fs_1.5.0          usethis_2.0.1     devtools_2.4.2    lubridate_1.7.10  bit64_4.0.5       httr_1.4.2       
     [7] rprojroot_2.0.2   tools_4.0.3       backports_1.2.1   bslib_0.3.0       utf8_1.2.2        R6_2.5.1         
    [13] vipor_0.4.5       DBI_1.1.1         colorspace_2.0-2  withr_2.4.2       prettyunits_1.1.1 processx_3.5.2   
    [19] tidyselect_1.1.1  bit_4.0.4         compiler_4.0.3    cli_3.0.1         rvest_1.0.1       pacman_0.5.1     
    [25] xml2_1.3.2        desc_1.3.0        sass_0.4.0        scales_1.1.1      callr_3.7.0       digest_0.6.27    
    [31] pkgconfig_2.0.3   sessioninfo_1.1.1 dbplyr_2.1.1      fastmap_1.1.0     htmlwidgets_1.5.3 rlang_0.4.11     
    [37] readxl_1.3.1      rstudioapi_0.13   RSQLite_2.2.8     jquerylib_0.1.4   generics_0.1.0    jsonlite_1.7.2   
    [43] crosstalk_1.1.1   magrittr_2.0.1    Rcpp_1.0.7        ggbeeswarm_0.6.0  munsell_0.5.0     fansi_0.5.0      
    [49] lifecycle_1.0.0   stringi_1.7.4     yaml_2.2.1        pkgbuild_1.2.0    grid_4.0.3        blob_1.2.2       
    [55] promises_1.2.0.1  ggrepel_0.9.1     crayon_1.4.1      haven_2.4.3       hms_1.1.0         ps_1.6.0         
    [61] pillar_1.6.2      pkgload_1.2.1     reprex_2.0.1      glue_1.4.2        remotes_2.4.0     modelr_0.1.8     
    [67] vctrs_0.3.8       tzdb_0.1.2        httpuv_1.6.2      testthat_3.0.4    cellranger_1.1.0  gtable_0.3.0     
    [73] assertthat_0.2.1  cachem_1.0.6      mime_0.11         xtable_1.8-4      broom_0.7.9       later_1.3.0      
    [79] rsconnect_0.8.24  beeswarm_0.4.0    memoise_2.0.0     ellipsis_0.3.2
    
  10. leonawicz commented on Sep 16, 2021

    @leonawicz

    @ngiangre You have to use Shiny v0.1.5.0 and load selectize.js v0.12.1. It's the latter that's key, but you won't be able to use this older selectize version with a newer version of Shiny due to other confllicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    UI toolkit: selectInput

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions