ebailey78 / shinyBS

Twitter Bootstrap Components for Shiny
182 stars 47 forks source link

Popover word limit? #30

Closed bwaismeyer closed 8 years ago

bwaismeyer commented 9 years ago

Dear Eric,

First off, thanks for the awesome set of Shiny extensions. It was delightful to find a package that not only had high-quality features but that also seemed to be written Shiny-style. Your work is very appreciated. =)

My question: What is the exact word limit for popover/tooltip content? I'm guessing there is one because I observed that some of my longer popovers simply won't activate when clicked.

Below are a pair of reproducible examples. The only (I think) difference between them is the length of the string passed to "content" in bsPopover.

Note: I've set the example to mirror some of the global features of my actual project (e.g., column width and page type) just in case those are relevant.

Thank again for your work and for any more time you have to share!

Warm regards, Brian

popover works

library(shiny)
shinyApp(
    ui = navbarPage(
        "The Case Outcome Simulator",

        # using COS to explore trends per predictor ("Explore Mode")
        tabPanel("Explore Mode", fluidPage(
            # define user tools in the first column
            # width = 3 of 12 (Shiny divides the horizontal space up into 12 sections)
            column(3, 
                   wellPanel(               
                       radioButtons("x_axis_choice", label = h4("Select X-Axis"), 
                                    choices = c("one", "two", "three")),

                       bsPopover("x_axis_choice",
                                 title = "Variable Definitions.",
                                 content = "<p> So many puppies! How do they make me feel? <br> I heart them. SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY much. </p>",
                                 trigger = "click",
                                 placement = "bottom")
                   )
            ),
            column(9,
                   textOutput("return_stuff")
            )
        ))
    ), 
    server = function(input, output, session) {
        output$return_stuff <- renderText({input$"x_axis_choice"})
    }
)

popover doesn't work

library(shiny)
shinyApp(
    ui = navbarPage(
        "The Case Outcome Simulator",

        # using COS to explore trends per predictor ("Explore Mode")
        tabPanel("Explore Mode", fluidPage(
            # define user tools in the first column
            # width = 3 of 12 (Shiny divides the horizontal space up into 12 sections)
            column(3, 
                   wellPanel(               
                       radioButtons("x_axis_choice", label = h4("Select X-Axis"), 
                                    choices = c("one", "two", "three")),

                       bsPopover("x_axis_choice",
                                 title = "Variable Definitions.",
                                 content = "<p> So many puppies! How do they make me feel? <br> I heart them. SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY SO VERY VERY VERY VERY VERY much. <br> I REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY REALLY can't stress this enough.</p>",
                                 trigger = "click",
                                 placement = "bottom")
                   )
            ),
            column(9,
                   textOutput("return_stuff")
            )
        ))
    ), 
    server = function(input, output, session) {
        output$return_stuff <- renderText({input$"x_axis_choice"})
    }
)
ebailey78 commented 9 years ago

That was a tricky one! It isn't a word limit, it was the apostrophe in your can't. I've added some code to replace single quotes with &#39;. It seems to work. I've pushed the change to github, or you can just replace the ' with &#39;. This fixes the example you provided but let me know if this doesn't fix the actual problem.

Thanks,

Eric

bwaismeyer commented 9 years ago

Awesome and thanks, Eric! I should have thought to look for XML/HTML restricted characters when I saw you breaking out that kind of syntax in your examples... I'll update my shinyBS and try out your fixes today! =)

bwaismeyer commented 9 years ago

I wasn't able to work with the updated shinyBS materials directly - devtools::install_github() kept dropping popify() on install and I use that nifty function. I admit that I was lazy and didn't try to install from source... =/

However, I confirmed that removing apostrophes or replacing them with &#39 made my code happy.

Calling attention to weaving HTML into my shinyBS popovers also helped me greatly improve my formatting.

Thank you again for the quick and helpful reply!

PS - Not sure about "closing" comment etiquette, but I feel the issue is resolved on my end!