1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 19:57:45 +00:00
serenity/Tests/LibWeb/Text/input/Editing/input-into-empty-contenteditable.html
Aliaksandr Kalenik 906ac71eca LibWeb: Fix crashing after input into empty contenteditable
Change `EventHandler::handle_keydown()` to no longer assume the cursor
position's node is always a `DOM::Text`. While this assumption holds
for `HTMLInputElement` that has a shadow DOM with a text node, an empty
`contenteditable` might not have any children. With this change,
`handle_keydown()` creates a new text node if the cursor position's
node is not a text node.
2024-02-24 08:09:01 +01:00

15 lines
342 B
HTML

<script src="../include.js"></script>
<style>
#input {
width: 100px;
height: 100px;
border: 1px solid black;
}
</style>
<div id="input" contenteditable="true"></div>
<script>
test(() => {
const input = document.getElementById("input");
internals.sendText(input, "hello");
});
</script>