Files
cthulhu/docs/testing/browser-editor.md

50 lines
2.7 KiB
Markdown

# Browser editor typing
Chromium contenteditable textboxes can keep native focus on an `entry` while
editable child paragraphs emit insertion, deletion, caret and selection events.
The native adapter records the nearest focusable writable editor as
`EditableRoot`, just as it records an editable document for document editors.
The event loop accepts that relationship only while that exact editor owns focus.
Lookup stops at document, window, password and read-only boundaries.
The reported ChatGPT failure was captured in the debug log on 2026-10-23:
paragraph text changes were rejected as outside the focused editor because
`editable_root` was empty. Following caret events then spoke the growing line.
Recognizing the parent editor restores configured typing echo and the existing
suppression of caret speech following a text change. This uses accessibility
identity and states; it does not depend on a website, label or DOM class.
## Automated checks
```sh
env CTHULHU_NATIVE_BROWSER_TESTS=editor python3 tests/native_browser.py
env CTHULHU_NATIVE_BROWSER_TESTS=editing,selection,live python3 tests/native_browser.py
python3 tests/native_test_session.py go test ./internal/app ./internal/atspi ./internal/presentation -count=1
```
The editor proof uses real Chromium paragraph events and the reader's event
pipeline on a private Xvfb display and D-Bus session. It checks quiet typing with
echo disabled, parent identity, character and line reading, deletion feedback,
and movement into another editor. Unit coverage checks disabled, character,
word and sentence echo, delayed events after focus leaves, existing editable
document handling, and Braille ownership.
## Live acceptance
After rebuilding and restarting the logging reader through its usual launcher:
1. In ChatGPT, compose several words, pause, and continue typing. With typing
echo disabled, each key must not reread the draft. With character or word
echo enabled, hear only the configured echo.
2. Use Left/Right, Control+Left/Right and Up/Down in a multiline draft. Confirm
character, word and line reading, Backspace/Delete feedback, and Shift-arrow
selection. Check Braille text and cursor placement if available.
3. Tab and Shift+Tab out of and back into the composer. Confirm focus labels
and that typing in another field cannot announce the old draft.
4. Check browser address-bar typing and suggestions, ordinary form fields,
password fields, and live status/response announcements. Check an editable
document body as well as its separate header fields when available.
Private test results do not establish audible speech or physical Braille
acceptance on the original ChatGPT page. That acceptance remains pending.