title: Add a button in full screen mode to reset to normal mode in a shiny app
body: <p>In the app below when I press the <code>actionButton()</code> I get a full screen of the plot. Is it possible to have a button to return, when in full screen mode under the plot, instead of clicking “Esc” on computers?</p>
  <pre><code>library(shiny)
  library(ggplot2)
  
  js &lt;- &quot;
  function openFullscreen(elem) {
    if (elem.requestFullscreen) {
      elem.requestFullscreen();
    } else if (elem.mozRequestFullScreen) { /* Firefox */
      elem.mozRequestFullScreen();
    } else if (elem.webkitRequestFullscreen) { /* Chrome, Safari and Opera */
      elem.webkitRequestFullscreen();
    } else if (elem.msRequestFullscreen) { /* IE/Edge */
      elem.msRequestFullscreen();
    }
  }&quot;
  
  css &lt;- &quot;
  #ggplot:-webkit-full-screen {
    height: 100%;
    margin: 0;
  }
  #ggplot:-ms-fullscreen {
    height: 100%;
  }
  #ggplot:fullscreen {
    height: 100%;
  }&quot;
  
  ui &lt;- fluidPage(
    tags$head(
      tags$script(HTML(js)),
      tags$style(HTML(css))
    ),
    br(),
    fluidRow(
      column(
        width = 3,
        actionButton(
          &quot;fs&quot;, &quot;Full screen&quot;, 
          onclick = &quot;openFullscreen(document.getElementById('ggplot'));&quot;
        )
      ),
      column(
        width = 9,
        plotOutput(&quot;ggplot&quot;)
      )
    )
  )
  
  server &lt;- function(input, output, session){
  
    output[[&quot;ggplot&quot;]] &lt;- renderPlot({
      ggplot(iris, aes(Sepal.Length, Sepal.Width)) + geom_point()
    })
  
  }
  
  
  shinyApp(ui, server)
  </code></pre>