Skip to content

test(ui-test): hand a page its undo keys on Windows - #92

Merged
BartvHelvert merged 1 commit into
masterfrom
fix/custom-document-undo
Nov 6, 2026
Merged

BartvHelvert merged 1 commit into
masterfrom
fix/custom-document-undo

Conversation

@BartvHelvert

@BartvHelvert BartvHelvert commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

What this changes

SplitModeCustomEditorTest failed on Windows at "the extension asked to undo" because of how the test types keys. CodeBridge itself is not at fault.

The UI tests have the driver post key events instead of typing them (driver.robot.use.input.events), and posted events carry no scan code. On Windows, JCEF's off-screen browser builds the page's key from the scan code alone, so it gets windows_key_code 0 and native_key_code 1. A diagnostic run of this PR showed every key with Ctrl held reaching the page as key="Unidentified" code=Escape keyCode=0, in both custom editor tests, so the page's keydown listener never saw an undo. On Linux JCEF maps from the Java key code, which posted events do have. The text editor test passes on Windows only because its undo goes through the IDE's own Undo on the text.

On Windows the test now hands the page its Ctrl+Z and Ctrl+Shift+Z keydowns with JavaScript. Elsewhere it still presses the keys. Ctrl+S is unchanged, because the IDE's Save handles it.

A real keyboard on Windows gives the scan code, so pages should see the undo keys there. That has not been checked by hand yet.

Fixes #87

How it was tested

  • SplitModeCustomEditorTest › "an extension's own document undoes its edits, saves, and is saved when closed with changes" passed locally on Windows 11 (65 s). It ran on the previous master; the branch was then rebased onto a4f7b06e, a ui-test-only change.
  • The full test suite was not run locally.
  • Not checked by hand: real Ctrl+Z, Ctrl+Shift+Z and Ctrl+Y in a custom document on Windows.

Checklist

  • Nothing is special-cased for one extension.
  • A new feature has a UI test. (a test fix)
  • No internal, override-only, obsolete or deprecated platform API.
  • docs/ is updated where behaviour changed, docs/status.md especially. (no behaviour changes)
  • Third-party material keeps its notice and is listed in NOTICE.md. (none added)

The driver posts key events instead of typing them, and they carry no
scan code. On Windows the off-screen browser makes a page's key from
the scan code alone, so every key reached the counter editor's page as
"Unidentified" (code Escape, keyCode 0) and the page never saw an
undo. On Windows the test now dispatches the undo and redo keydowns in
the page itself. Elsewhere it still presses the keys.

A real keyboard gives the scan code, so this is not a product bug.

Refs #87
@BartvHelvert BartvHelvert changed the title fix(webview): read Ctrl+Z as undo in pages on Windows test(ui-test): hand a page its undo keys on Windows Nov 6, 2026
@BartvHelvert
BartvHelvert marked this pull request as ready for review November 6, 2026 22:56
@BartvHelvert
BartvHelvert merged commit 740ddea into master Nov 6, 2026
6 of 8 checks passed
@BartvHelvert
BartvHelvert deleted the fix/custom-document-undo branch November 6, 2026 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Undo in an extension's own custom document doesn't reach the extension on Windows

1 participant