Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

delay attribute not fully working in bs_embed_tooltip #50

Closed
dylancis opened this issue Apr 8, 2018 · 4 comments
Closed

delay attribute not fully working in bs_embed_tooltip #50

dylancis opened this issue Apr 8, 2018 · 4 comments

Comments

@dylancis
Copy link

dylancis commented Apr 8, 2018

as per bs doscs the delay attribute should accept:
delay: { "show": 500, "hide": 100 }
However trying the R equivalent failed(i.e. get ignored) while passing a single a number (hence applied to both show and hide works). Not sure If I am doing anything wrong with the syntax but JSONifying my argument looks file:

> toJSON(list("show" = 500, "hide" = 100), auto_unbox = T)
{"show":500,"hide":100} 

How do I apply different number to show and hide parameters please?
Reproducible example (delay argument has no impact):

library(shiny)
library(bsplus)
library(shinyWidgets)

ui <- fluidPage(
  
  use_bs_tooltip(), # you need to call this function somewhere in your ui
  
  titlePanel("Hello Shiny!"),          
  sidebarLayout(
    sidebarPanel(
      shinyWidgets::materialSwitch(inputId = "testBS", label = "Test BS") %>%
            bs_embed_tooltip(title =  "this one is not okay!", 
                             trigger = "hover", delay = list("show" = 3500, "hide" = 50))
    ),
    mainPanel(
      
    )
  )
)

server <- function(input, output) {
  
}

shinyApp(ui, server)

While single number works fine:

library(shiny)
library(bsplus)
library(shinyWidgets)

ui <- fluidPage(
  
  use_bs_tooltip(), # you need to call this function somewhere in your ui
  
  titlePanel("Hello Shiny!"),          
  sidebarLayout(
    sidebarPanel(
      shinyWidgets::materialSwitch(inputId = "testBS", label = "Test BS") %>%
            bs_embed_tooltip(title =  "this one is okay!", 
                             trigger = "hover", delay = 2500)
    ),
    mainPanel(
      
    )
  )
)

server <- function(input, output) {
  
}

shinyApp(ui, server)
@ijlyttle
Copy link
Owner

ijlyttle commented Apr 8, 2018

I don't think that I am supporting lists to be translated as attributes - so I think this is where the problem is. Let me think a bit on how lists might be supported.

@ijlyttle
Copy link
Owner

ijlyttle commented Apr 8, 2018

Hi @dylancis,

I have added support for lists, so that your example should work. The core function, bs_attr(), now does this:

library("bsplus")

bs_attr(list("show" = 3500, "hide" = 50))
{"show":3500,"hide":50} 

I have pushed this change to master, can you install the dev version and see if this solves your problem?

Thanks,

Ian

@dylancis
Copy link
Author

dylancis commented Apr 9, 2018

HI @ijlyttle ,
Works perfectly indeed!
Many thanks for your very quick enhancement.

Dylan

@ijlyttle
Copy link
Owner

ijlyttle commented Apr 9, 2018

No problem, thanks for raising the issue!

@ijlyttle ijlyttle closed this as completed Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants