Conceptually unrelated to this PR, but this WebPreview class component could be a good candidate for refactoring into a functional component with hooks in a future PR, which would simplify lifecycle management (e.g., using useEffect for event listeners instead of componentDidUpdate/componentWillUnmount).
Escape-to-close doesn't fire once focus is inside the iframe, where users typically interact during preview. Keydown events on the parent document are not received by the iframe. Consider wiring a keydown handler to the iframe's contentWindow on load (guarded for same-origin).
See details