rstudio / shinydashboard

Shiny Dashboarding framework
https://rstudio.github.io/shinydashboard/
Other
896 stars 298 forks source link

dashboardPage shouldn't create <title> HTML tags if title = NULL #393

Open Mkranj opened 1 year ago

Mkranj commented 1 year ago

Description

I'm using several dashboardPages inside of a navbarPage tabset for a project. Each call to dashboardPage automatically creates a new tag in the finished app's HTML, even though <em>title</em> is set to NULL in dashboardPage, as well as in dashboardHeader. This creates problems, e.g., for screen readers.</p> <h1>Proposed outcome</h1> <p>If <code>title = NULL</code> in both dashboardPage and dashboardHeader, no additional <title> tags should be generated.</p> <h1>Example of issue</h1> <p>Run the following code snippet, and check the resulting page's source HTML:</p> <pre><code>ui <- navbarPage( title = "Actual title", dashboardPage( title = NULL, dashboardHeader(title = NULL), dashboardSidebar(), dashboardBody() ) ) server <- function(input, output, session) { } shinyApp(ui, server)</code></pre> <p>Only <em><title>Actual title is supposed to be present, but there's also an additional For precedents, consider what happens when setting title = NULL in the navbarPage. This generates no empty , leaving only the one generated by dashboardPage!

Mkranj commented 1 year ago

If the snippet throws an error, I've wrapped the dashboardPage in a tabPanel:

ui <- navbarPage(
  title = "Actual title",
  tabPanel(
  dashboardPage(
    title = NULL,
    dashboardHeader(title = NULL),
    dashboardSidebar(),
    dashboardBody()
  )
  )
)

server <- function(input, output, session) {

}

shinyApp(ui, server)