bs4Dash and shinyalert
gueyenono opened this issue · comments
First, I'd like to thank you very much for an awesome package.
I am experiencing a few oddities when using shinyalert
inside a bs4Dash
application. What follows could be reported in two distinct issues and I could do that if need be.
MathJax is not rendered
I am rendering an Rmarkdown (actually bookdown) HTML document inside shinyalert
. Although the document is displayed properly inside the modal, the MathJax equations are not rendered despite the use of shiny::withMathJax()
.
Overall aspect of boxes changes
I am using bs4Dash::box
-es inside my application and whenever I open the shinyalert
containing my HTML document the font size of the box titles shrinks, horizontal scrollbars appear in my boxes and the overall layout of the app changes slightly. I must add that, to my knowledge, this behavior ONLY occurs when I include a rendered HTML document inside the shinyalert
modal.
Reproducible example
Since my reproducible example involves 2 files, I created the following repository, which can be easily cloned:
https://gitlab.com/gueyenono/rmarkdown-shinyalert-mathjax
app.R
library(shiny)
library(bs4Dash)
library(rhandsontable)
shinyApp(
ui = dashboardPage(
title = "Basic Dashboard",
header = dashboardHeader(),
sidebar = dashboardSidebar(),
controlbar = dashboardControlbar(),
footer = dashboardFooter(),
body = dashboardBody(
box(
title = "Car values",
rHandsontableOutput(outputId = "data"),
br(),
actionButton("btn", "OK")
)
)
),
server = function(input, output) {
output$data <- renderRHandsontable({
rhandsontable(mtcars)
})
observeEvent(input$btn, {
shinyalert::shinyalert(
title = "Nice modal",
html = TRUE,
text = div(
withMathJax(includeHTML("www/document.html"))
)
)
})
}
)
document.Rmd (to be knit to HTML)
---
output: bookdown::html_document2
---
## Linear regression
The matrix formula on the OLS estimator is:
$$
\beta_{OLS} = (X^TX)^{-1}X^TY
$$
I've opened a separate issue #54 for the mathjax issue.
Can you post a reprex or a small code sample to show the issue you describe with bs4dash boxes?
@gueyenono I plan on submitting shinyalert to CRAN soon for a new version, so let me know if I should wait for this
@daattali Actually, I just tested it. It seems that the call to withMathJax(includeHTML("www/document.html"))
is the culprit here. When I comment it out and launch my example above, the problem vanishes for some reason. So, the two issues are indeed linked I guess.
So can I close this issue?