ebailey78 / shinyBS

Twitter Bootstrap Components for Shiny
182 stars 47 forks source link

behavior change request: limit element regions that trigger popover #35

Open bwaismeyer opened 9 years ago

bwaismeyer commented 9 years ago

Currently, the region of an element that can be interacted with to trigger a popover seem to be inconsistent. It appears to vary both by element type and trigger type.

For example, here is an example with two kinds of shiny elements (radioButtons v. inputSliders) with two kinds of popover triggers (click v. hover).

The popover for each element behaves differently. In the order the elements are presented, the popover responds to interactions with...

  1. any part of the non-input region (i.e., anywhere but the choice buttons)
  2. any region
  3. a specific feature of the input region (i.e., only the slider knob; not to clicks on the slider bar or non-input regions)
  4. any part of the input region (but not non-input regions, such as the label)
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("a", label = h4("Select X-Axis"), 
                                    choices = c("one", "two", "three")),

                       bsPopover("a",
                                 title = "VD1",
                                 content = "STUFF",
                                 trigger = "click",
                                 placement = "right"),

                       radioButtons("b", label = h4("Select X-Axis"), 
                                    choices = c("one", "two", "three")),

                       bsPopover("b",
                                 title = "VD2",
                                 content = "STUFF",
                                 trigger = "hover",
                                 placement = "right"),

                       sliderInput("c", label = h4("Select X-Axis"), 
                                    min = 0, max = 100, value = 50),

                       bsPopover("c",
                                 title = "VD3",
                                 content = "STUFF",
                                 trigger = "click",
                                 placement = "right"),

                       sliderInput("d", label = h4("Select X-Axis"), 
                                   min = 0, max = 100, value = 50),

                       bsPopover("d",
                                 title = "VD4",
                                 content = "STUFF",
                                 trigger = "hover",
                                 placement = "right")
                   )
            ),
            column(9,
                   textOutput("return_stuff")
            )
        ))
    ), 
    server = function(input, output, session) {
        output$return_stuff <- renderText({input$"x_axis_choice"})
    }
)

It would be nice if popover response was consistent across element types and trigger types.

I think having the popover occur only during interactions with non-input regions makes the most sense (as otherwise users may have to engage inputs to see desired information). But I'm biased by my project needs. :smile:

Alternatively, allowing us to choose something like trigger_region would work great too...

Thanks again for your work and patience, Eric!!

ebailey78 commented 8 years ago

This is a good point that I was noticing when I was running through the examples on your previous issues. I will make a change so that tooltips and popovers will be attached to the closest .shiny-input-container. This should help make the trigger region more consistent. That is a quick fix that at least addresses some of your issue. I will push and updates version and look at your issue more closely after I work through all the other issues. Thanks

bwaismeyer commented 8 years ago

Awesome and thanks, Eric!