[ZEPPELIN-6559] Drop the faked Windows user agent so Monaco keybindings match the host platform - #5342
Merged
tbonelee merged 1 commit intoJul 27, 2026
Conversation
voidmatcha
force-pushed
the
fix/e2e-monaco-keybinding-platform
branch
from
July 26, 2026 06:46
0ac7735 to
4841c5b
Compare
tbonelee
approved these changes
Jul 27, 2026
Contributor
|
Merged into master |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this PR for?
playwright.config.jsbuilds the chromium project fromdevices['Desktop Chrome'], whoseuserAgentis a hardcodedWindows NT 10.0string regardless of the host. Monaco picks its keybinding platform by sniffing that user agent, while Playwright's key resolution (ControlOrMeta) and the browser's native text editing follow the real OS. On a macOS host those disagree, and two things break.defaultPrevented === false, so macOS Chromium runs its native Emacs-style caret binding inside Monaco's hidden textarea. The next typed character then lands in the wrong place: pressingControl+Pand typingMARKERyieldsMon its own line andline2ARKERbelow it.Meta+Aselect-all is a silent no-op.pressSelectAllresolvesControlOrMeta+AtoMeta+Aon macOS, but Windows-mode Monaco only bindsCtrl+A. No model event fires, so every select-all in the suite quietly did nothing locally.Linux CI is unaffected because its Chromium build has no native caret bindings, which is why this only ever showed up locally. Real users are not affected either: with a genuine macOS user agent Monaco runs in mac mode and calls
preventDefault. This is a test-harness defect only.Unsetting the override is what Playwright recommends for this case (https://playwright.dev/docs/emulation#devices):
webkit deliberately keeps its
Desktop Safarimac user agent, because the page objects'Meta+Abranch depends on it.Local (macOS) and CI (Linux) no longer share one keybinding platform as a result. That uniformity was not worth keeping: under it, select-all on macOS produced no model event at all, so the suite ran locally without exercising what it claimed to.
What type of PR is it?
Bug Fix
Todos
navigator.userAgentreports the host platform after the changeWhat is the Jira issue?
ZEPPELIN-6559
How should this be tested?
CI covers the regression side: the full chromium suite reports 546 passed with no failure attributable to this change.
The fix itself is only observable on a macOS host:
Before: 3 passed, 1 failed (
ParagraphActions.MoveCursorUp: Control+P). Because the suite isdescribe.serial, that first failure blocks every later test in the file.After: 31 passed, 0 failed.
To confirm the user agent directly, read
navigator.userAgentin any spec. It changes from theWindows NT 10.0string toMozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) ....Screenshots (if appropriate)
N/A
Questions: