ladybird/Tests/LibWeb/Text/input/input-delete.html
Timothy Flynn c369f68eff LibWeb: Delete entire graphemes when the delete/backspace key is pressed
We currently delete a single code unit. If the user presses backspace on
a multi code point emoji, they are going to expect the entire emoji to
be removed. This now matches the behavior of Chrome and Firefox.
2025-08-14 22:21:51 +02:00

24 lines
723 B
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<script src="include.js"></script>
<input id="a" value="foo👩🏼👨🏻bar" />
<input id="b" value="foo👩🏼👨🏻bar" />
<script>
test(() => {
const testDelete = function (id, position, key) {
println(`--- ${id} ---`);
const input = document.querySelector(`input#${id}`);
println(`Before: ${input.value}`);
// Place cursor
input.setSelectionRange(position, position);
// Press backspace
internals.sendKey(input, key);
println(`After: ${input.value}`);
};
testDelete("a", 15, "Backspace");
testDelete("b", 3, "Delete");
});
</script>