added preventdefault test

This commit is contained in:
Stian Lund
2023-07-21 14:28:10 +02:00
parent 7853530226
commit 00dd5d05f2
2 changed files with 26 additions and 1 deletions
+24
View File
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<title>Vivaldi Fast Forward vs. preventDefault()</title>
</head>
<body>
<p>You cannot use Space inside the input:</p>
<p><input autofocus></p>
<p>Press ESC to escape the input and press Space.</code></p>
<p>The link should not be followed if Space is blocked by <code>event.preventDefault()</code> - or should it?</p>
<p><a href="https://example.com/" rel="next">Next</a></p>
<script>
window.onkeydown = function (event) {
if (event.keyCode === 32) {
event.preventDefault();
//event.stopImmediatePropagation();
//event.stopPropagation();
}
};
</script>
</body>
</html>