JSFiddle - React, Tailwind, and code Playground

by g12ng

HTML

<html>
<body>
<details>
  <summary id="the-summary">
    <div id="innerdiv" contenteditable>
    You can edit me but can't add spaces in Firefox
    </div>
  </summary>
  Extra details you shouldn't see while typing.
</details>
</body>
</html>

CSS

#innerdiv { display: inline; }

JavaScript

const summary = document.getElementById('the-summary');
const innerdiv = document.getElementById('innerdiv');

summary.addEventListener('keyup', e => {
  if (e.keyCode === 32) {
     e.preventDefault();     
  }
});

summary.addEventListener('click', e => e.preventDefault() );