shinydashboard icon indicating copy to clipboard operation
shinydashboard copied to clipboard

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

Open Mkranj opened this issue 2 years ago • 1 comments

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. <h1>Proposed outcome</h1> <p>If <code>title = NULL</code> in both dashboardPage and dashboardHeader, no additional </p><title> tags should be generated. <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 avatar Mar 02 '23 07:03 Mkranj

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)

Mkranj avatar Mar 03 '23 09:03 Mkranj