mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
Browsers seem to make it convenient to replace an <input>'s contents by selecting all text on focusing, but only if you used keyboard navigation. Programmatic focus and clicking on the field do not show this behavior.
20 lines
476 B
HTML
20 lines
476 B
HTML
<!DOCTYPE html>
|
|
<input id="a" value="hello" />
|
|
<input id="b" value="world" />
|
|
<input id="c" />
|
|
<script src="include.js"></script>
|
|
<script>
|
|
test(() => {
|
|
a.focus();
|
|
a.offsetWidth;
|
|
|
|
println(`a: ${a.selectionStart} ${a.selectionEnd}`);
|
|
|
|
internals.sendKey(a, "Tab");
|
|
println(`b: ${b.selectionStart} ${b.selectionEnd}`);
|
|
|
|
internals.sendKey(b, "Tab");
|
|
println(`c: ${c.selectionStart} ${c.selectionEnd}`);
|
|
});
|
|
</script>
|