Skip to content

Instantly share code, notes, and snippets.

@Nosgoroth
Created September 17, 2024 10:25
Show Gist options
  • Save Nosgoroth/b8062ef38581edb6bebcb384df465257 to your computer and use it in GitHub Desktop.
Save Nosgoroth/b8062ef38581edb6bebcb384df465257 to your computer and use it in GitHub Desktop.
iPadOS 18 Safari keyboard bug reproduction
<!DOCTYPE html><html>
<head>
<title>iPadOS 18 Safari Bug reproduction page</title>
</head><body>
<h2>Bug reproduction controls</h2>
<button id="test1">Open new tab</button>
<p>Latest document keyboard event keycode was <span id="eventid">-</span> at <span id="eventtime">-</span></p>
<h2>Description</h2>
<p>After opening a new tab using the above button and returning to this tab, keyboard events will no longer be registered. The only way of getting input back I've found is to reload the tab. This happens in Safari and other apps using a webview.</p>
<p>The button opens a new tab using <code>window.open("https://www.apple.com", "_blank")</code>, but other methods may produce the same result.</p>
<p>Keyboard events listener is <code>document.addEventListener("keyup", e=>{})</code></p>
<script type="text/javascript">
const _btn = document.getElementById("test1");
const _eventid = document.getElementById("eventid");
const _eventtime = document.getElementById("eventtime");
_btn.addEventListener("click", e => {
e.preventDefault();
e.stopPropagation();
window.open("https://www.apple.com", "_blank");
});
document.addEventListener("keyup", e => {
_eventid.innerHTML = e.keyCode;
_eventtime.innerHTML = (new Date()).toString();
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment