Highcharter is NOT automatically resize output in shinydashboard

The development-version of highcharter package has the following issue:

highchartOutput DOES NOT automatically resize the width of the plot when hiding the sidebar in shinydashboard. The width of the plot always remains same.

I provide an example here,

# install development-version of highcharter
# devtools::install_github("jbkunst/highcharter")

library(shinydashboard)
library(shiny)
library(highcharter)
library(dplyr)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(),
  dashboardBody(
    box(
      width = 12,
      highchartOutput("plot")
    )
  )
)

server <- function(input, output) {
  
  output$plot <- renderHighchart({
    highcharts_demo()
  })
}

shinyApp(ui, server)

sidebar is shown

sidebar is hidden

I have tried

$(document).on("click", ".sidebar-toggle", function() { $(window).trigger("resize"); });

BUT it still does not work for development-version highcharter when I use renderHighchart & highchartOutput functions.

However, I found

  • renderHighchart2 and highchartOutput2 working well for resizing.

  • BUT renderHighchart2 and highchartOutput2 DO NOT support heatmap, I still need to use renderHighchart and highchartOutput to get correlation plot.

ANY suggestions for this resizing problem?