Chromium does not announce children, or a generic container, that become editable when an ancestor turns contenteditable. A state cached while the text was read-only survived, so caret moves in ChatGPT's canvas editor were dropped as stray document caret events and the first verse went silent. Re-read the state once when a caret event, or focus on a generic text container, has a cached read-only state. The late-editable native browser proof fails without the change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
29 lines
1.0 KiB
HTML
29 lines
1.0 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<meta charset="utf-8">
|
|
<title>Cthulhu Browser Probe</title>
|
|
<button autofocus id="open">Open editor</button>
|
|
<div id="editor" aria-label="Start writing">
|
|
<p>First verse line one.<br>First verse line two.</p>
|
|
<p>Second verse line one.<br>Second verse line two.</p>
|
|
</div>
|
|
<script>
|
|
// Like ChatGPT's canvas: the paragraphs exist, read-only, before the
|
|
// editor turns editable. Chromium does not announce the children's new
|
|
// editable state, so a cached state stays read-only.
|
|
document.getElementById("open").addEventListener("click", () => {
|
|
const editor = document.getElementById("editor");
|
|
editor.setAttribute("role", "textbox");
|
|
editor.setAttribute("aria-multiline", "true");
|
|
editor.contentEditable = "true";
|
|
editor.focus();
|
|
const range = document.createRange();
|
|
range.setStart(editor.querySelector("p").firstChild, 0);
|
|
range.collapse(true);
|
|
const selection = window.getSelection();
|
|
selection.removeAllRanges();
|
|
selection.addRange(range);
|
|
});
|
|
</script>
|
|
</html>
|