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

Control bar not showing top elements when collapsed == FALSE #47

Closed
wdm0336 opened this issue Jul 25, 2019 · 3 comments
Closed

Control bar not showing top elements when collapsed == FALSE #47

wdm0336 opened this issue Jul 25, 2019 · 3 comments

Comments

@wdm0336
Copy link

wdm0336 commented Jul 25, 2019

When a control bar is created and controlbar_collapsed = FALSE, then the control bar is created and the top elements are not visible. If the control bar is collapsed and then un-collapsed, the elements appear.

It appears that the elements are hidden underneath the navbar until re-displayed.

using 0.4.0.9000

@DivadNojnarg
Copy link
Member

Do you mean something like this?

library(shiny)
library(bs4Dash)

shiny::shinyApp(
  ui = dashboardPage(
    controlbar_collapsed = FALSE,
    navbar = dashboardHeader(
      rightUi = bs4DropdownMenu(
        show = TRUE,
        labelText = "!",
        status = "danger",
        src = "http://www.google.fr",
        bs4DropdownMenuItem(
          text = "message 1",
          date = "today"
        ),
        bs4DropdownMenuItem(
          text = "message 2",
          date = "yesterday"
        )
      )
    ),
    sidebar = dashboardSidebar(),
    body = dashboardBody(),
    controlbar = dashboardControlbar(
      skin = "light",
      controlbarMenu(
        side = "left",
        id = "tabsetpanel",
        controlbarItem(
          tabName = "Tab 1",
          br(),
          sliderInput(
            "obs",
            "Number of observations:",
            min = 0,
            max = 1000,
            value = 500
          )
        ),
        controlbarItem(
          tabName = "Tab 2",
          br(),
          checkboxGroupInput(
            "variable",
            "Variables to show:",
            c("Cylinders" = "cyl",
              "Transmission" = "am",
              "Gears" = "gear")
          )
        ),
        controlbarItem(
          tabName = "Tab 3",
          br(),
          selectInput(
            "state",
            "Choose a state:",
            list(`East Coast` = list("NY", "NJ", "CT"),
                 `West Coast` = list("WA", "OR", "CA"),
                 `Midwest` = list("MN", "WI", "IA")
            )
          )
        )
      )
    )
  ),
  server = function(input, output) {
    output$distPlot <- renderPlot({
      hist(rnorm(input$obs))
    })
    
    output$data <- renderTable({
      head(mtcars[, c("mpg", input$variable), drop = FALSE])
    }, rownames = TRUE)
    
    output$result <- renderText({
      paste("You chose", input$state)
    })
  }
)

It works for me. Maybe you can send me an example or a screenshot.

@wdm0336
Copy link
Author

wdm0336 commented Jul 26, 2019

Here is a minimal example. Sorry I didn't include at the onset.

If you remove the style argument out of the statement tags$p("Bs4Dash", style="font-size:40px"), then it renders correctly out of the box.

But with the style argument in there, it does not render correctly unless you close the controlbar and reopen it. In fact, as soon as you click the "close control bar" icon, it renders correctly before the control bar closes.

library(shiny)
library(bs4Dash)

shiny::shinyApp(
    ui <- bs4DashPage(
        old_school = FALSE,
        sidebar_collapsed = TRUE,
        controlbar_collapsed = FALSE,
        title = "Control Bar Checkbox Hidden",
        sidebar = bs4DashSidebar(
            title = "Sidebar",
            bs4SidebarMenu(
            )
        ),
        navbar = bs4DashNavbar(
            skin = "light",
            status = "white",
            border = TRUE,
            sidebarIcon = "bars",
            fixed = FALSE,
            tags$a(href="https://github.com/RinteRface/bs4Dash", tags$p("Bs4Dash", style="font-size:40px"))
        ),
        controlbar = bs4DashControlbar(
            skin = "light",
            checkboxInput(inputId = "showVis", label = "Check Me", value = FALSE)
        ),
        body = bs4DashBody(
            bs4TabItems(
                bs4TabItem(
                    tabName = "First_Tab",
                    tags$p("Here is the first tab")
                )
            )
        )
    ),
    server = function(input, output) { }
)

@DivadNojnarg
Copy link
Member

This is due to the class layout-fixed in the body element. It somehow messes up with the controlbar.

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