Skip to content

Reprex for mutliInput issue #751

Description

@nirguk

I wanted to share an issue with a usecase for multInput.


library(shiny)
library(shinyWidgets)
library(tidyverse)

ui <- fluidPage(
  uiOutput("out1")
)

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

  output$out1 <- renderUI({
    
    must_have_vars <- c('abc','xyz')
    
    
     cv <- cn <- c('abc','master','margin','mentions svg','xyz')
    
    skipflag <- FALSE
    
    
    if(is.null(must_have_vars)){
      must_have_vars <- from_file
      skipflag <- TRUE
    }
    
    if(!skipflag){
      (must_locations <- which(cn %in% must_have_vars))
      cn <- map(cn,tagList)
      cn[must_locations] <- map(cn[must_locations],\(x)tagList(fontawesome::fa("lock"),x))
    }

  multiInput(
    inputId = "master_dynamic_column_selection",
    label = h4("Select Variables"),
    choiceNames = cn,
    choiceValues = cv,
    selected = must_have_vars,
    width = "700px"
  )
 
  })
}

shinyApp(ui, server)

at a high level we can say that we are using choiceNames/choiceValues; so that some visual - fontawesome representing variables we must keep and aren't an option, are flagged); This HTML is apparently part of the search ; so that for example svg , margin which are present in the entries HTML will match when a user searches svg, or searches margin.

try searching abc or xyz and seeing the expected result in the left side view; also master, will work as expected.
however both svg and margin will fail as other elements contain that (in a subtle not obvious to user way)

I found in the multi.min.js that k = i.textContent || i.innerText
might be responsible as we are potentially involving the appearance (HTML content) of an entry in the search behaviour.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions