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

UI is not displayed properly in the latest Boostrap4-based bs4Dash package #158

Closed
jnhyeon opened this issue Jun 29, 2021 · 17 comments
Closed

Comments

@jnhyeon
Copy link

jnhyeon commented Jun 29, 2021

Thank you for making such a wonderful package.
Your package works fine with Bootstarp3 based shinydashboard, shinydashboardplus packages.
However, the UI is not displayed properly in the latest Boostrap4-based bs4Dash package.
I hope your package also works well with the bs4Dash package.

Thank you.

@vnijs
Copy link
Collaborator

vnijs commented Jun 30, 2021

Can you try out the development version? Alignment should look a little better at least. If you see problems please provide screenshots. The dropdown buttons do not work in bs4. I asked the developer of bslib for any suggestions (see issue linked below).

rstudio/bslib#347

@jnhyeon
Copy link
Author

jnhyeon commented Jun 30, 2021

Thank you for the reply.
I installed the developer version (0.9.0.90000) with devtools::install_github('thomasp85/shinyFiles').
However, the UI of shinyDirButton is still not displayed properly in bs4Dash.
'Contents' is under 'Directories'.
Thank you.

image

@vnijs
Copy link
Collaborator

vnijs commented Jun 30, 2021

I have not used b4dash. Only bslib. Can you provide a minimal reproducible example?

@jnhyeon
Copy link
Author

jnhyeon commented Jun 30, 2021

Please refer to the code below.
Thank you.

library(shiny)
library(bs4Dash)
library(shinyFiles) # devtools::install_github('thomasp85/shinyFiles')

ui <- dashboardPage(
dashboardHeader(title = "Basic dashboard"),
dashboardSidebar(),
dashboardBody(
fluidRow(
box(width = 12,
fluidRow(
column(6,
shinyFilesButton("file", "File select", "Please select a file",
multiple = FALSE)
),
column(6,
shinyDirButton("directory", "Folder select", "Please select a folder")
)
)
)
)
)
)

server <- function(input, output, session) {
volumes <- c(Home = fs::path_home(), getVolumes()())

shinyFileChoose(input, "file", roots = volumes, session = session)

shinyDirChoose(input, "directory", roots = volumes, session = session)
}

shinyApp(ui, server)

@vnijs
Copy link
Collaborator

vnijs commented Jul 1, 2021

Thanks @jnhyeon. With the help of @cpsievert I think I have most of the changes addressed. However, not the issue why these windows are no longer shown in-line as they were before. Perhaps @thomasp85 has some ideas?

@ruthkr
Copy link

ruthkr commented Jul 4, 2021

Hi, @vnijs I think I've found a fix for the element distribution in the modal in Bootstrap 4 using {bslib} (and presumedly {bs4Dash}). I've just added the following to my to my CSS stylesheet, and everything looks correctly aligned in the modal:

.sF-dirWindow {
  display: flex;
}

.sF-breadcrumps {
  width: calc(100% - 380px) !important;
}

image

If you want, I can try adding these changes to the package and make a pull request.

vnijs added a commit that referenced this issue Jul 4, 2021
@vnijs
Copy link
Collaborator

vnijs commented Jul 4, 2021

Thank you @ruthkr! That was very helpful. Please try out the latest commit

@jnhyeon
Copy link
Author

jnhyeon commented Jul 4, 2021

Thanks to @vnijs and @ruthkr.
I can finally upgrade my company project from shinydashboardplus package to bs4Dash package.

Thank you very much. :)

@vnijs
Copy link
Collaborator

vnijs commented Nov 6, 2021

Closing. Pushing new version to CRAN soon

@vnijs vnijs closed this as completed Nov 6, 2021
@ShinyFabio
Copy link

Hi, this problem persists if I use a {fresh} theme inside bs4Dash package. Here's a reproducible example:

library(shiny)
library(bs4Dash)
library(shinyFiles) # devtools::install_github('thomasp85/shinyFiles')
library(fresh)


ui <- dashboardPage(
  dashboardHeader(title = "Basic dashboard",skin = "light", status = "primary"),
  dashboardSidebar(skin = "light"),
  dashboardBody(

    fresh::use_theme(
      fresh::create_theme(
        fresh::bs4dash_vars(navbar_light_color = "#2c2f76")
      )
    ),
    
    fluidRow(
      box(width = 12,
          fluidRow(
            column(6,
                   shinyFilesButton("file", "File select", "Please select a file",
                                    multiple = FALSE)
            ),
            column(6,
                   shinyDirButton("directory", "Folder select", "Please select a folder")
            )
          )
      )
    )
  )
)

server <- function(input, output, session) {
  volumes <- c(Home = fs::path_home(), getVolumes()())
  
  shinyFileChoose(input, "file", roots = volumes, session = session)
  
  shinyDirChoose(input, "directory", roots = volumes, session = session)
}

shinyApp(ui, server)

@vnijs
Copy link
Collaborator

vnijs commented Apr 1, 2022

Not sure what the issue but I can't even get the buttons to work in this demo, presumably, due to a conflict with bs4Dash. shinyFiles works as expected with the Rstudio-supproted bslib. If you supply a PR with a fix that would make this work with bs4Dash as well I would be happy to review.

image

@ShinyFabio
Copy link

Exactly, it doesn't open anything. I don't have your devtools error. I just took the previous example from jnhyeon and added the fresh theme. As you can see it seems that everything is rendered but not displayed.

Screenshot (231)

However what is a PR? I'm sorry I'm not English.

@vnijs
Copy link
Collaborator

vnijs commented Apr 5, 2022

A PR is a "Pull Request". It is a suggested fix for the problem that you are seeing. shinyFiles works as intended with bslib which is supported by Rstudio and offers access to bootstrap 3 and 4. It would be nice if everything worked with other libraries as well that is not something that I can currently carve out time for if it is not working. Sorry

@ShinyFabio
Copy link

Ah ok now I understood. I can have a look but I'm not very skilled

@vojtam
Copy link

vojtam commented Feb 4, 2023

@ShinyFabio I had the same problem. The solution I found is to add this line to my CSS stylesheet.

.fade:not(.show) {
  opacity: 1; !important
}

@vnijs
Copy link
Collaborator

vnijs commented Feb 5, 2023

@vojtam Thanks. What does this do exactly?

@vojtam
Copy link

vojtam commented Feb 23, 2023

I had the same problem where sf dialog window wasn't visible when using bs4Dash. Digging through developer tools revealed that this CSS class set the opacity to 0, leaving the modal window invisible. Adding the above rule to my stylesheet solved the problem. I'm aware that using !important should be avoided.

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

5 participants