JSFiddle - React, Tailwind, and code Playground

by Chris5

HTML

<div></div>

CSS

div {
  background: red;
}

JavaScript

document.addEventListener("keyup", async (e) => {
  e.preventDefault();
  if (document.fullscreenElement)
    return document.exitFullscreen()
  document.body.firstElementChild.requestFullscreen();  // Fails on CTRL, SHIFT, ALT ...
});