Plotly fullscreen

Is there a way to get my plots into fullscreen mode? I couldn’t find anything in the documentation for it. For now I’m using this snippet which replaces the plotly logo with a fullscreen button. To test it, open Line plots in R and paste it into the brower console.

  function plotZoom(el){
      if(document.fullscreen) {
        document.exitFullscreen()
      } else {
        $(el).closest('.js-plotly-plot')[0].requestFullscreen();
      }
  }

  $( document ).ready(function() {
    $(".modebar-btn.plotlyjsicon.modebar-btn--logo").replaceWith(
    `
    <a rel="tooltip" onclick=plotZoom(this) class="modebar-btn fullscreen-btn" data-title="Full Screen" data-attr="zoom" data-val="auto" data-toggle="false" data-gravity="n" >
      <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="icon" height="1em" width="1em">
        <!--! Font Awesome Pro 6.1.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc. -->
        <path d="M128 32H32C14.31 32 0 46.31 0 64v96c0 17.69 14.31 32 32 32s32-14.31 32-32V96h64c17.69 0 32-14.31 32-32S145.7 32 128 32zM416 32h-96c-17.69 0-32 14.31-32 32s14.31 32 32 32h64v64c0 17.69 14.31 32 32 32s32-14.31 32-32V64C448 46.31 433.7 32 416 32zM128 416H64v-64c0-17.69-14.31-32-32-32s-32 14.31-32 32v96c0 17.69 14.31 32 32 32h96c17.69 0 32-14.31 32-32S145.7 416 128 416zM416 320c-17.69 0-32 14.31-32 32v64h-64c-17.69 0-32 14.31-32 32s14.31 32 32 32h96c17.69 0 32-14.31 32-32v-96C448 334.3 433.7 320 416 320z"/>
      </svg>
    </a>
    `);
  });