diff --git a/src/index.css b/src/index.css index c166d80..843c394 100644 --- a/src/index.css +++ b/src/index.css @@ -107,6 +107,9 @@ body { -webkit-app-region: drag; flex-shrink: 0; transition: padding-left 0.2s ease; + /* Chrome is not part of the document: keep it out of Select All / copy */ + user-select: none; + -webkit-user-select: none; } /* Toolbar in fullscreen mode (no traffic lights) */ @@ -457,6 +460,9 @@ body { font-size: 12px; color: var(--text-muted); flex-shrink: 0; + /* Chrome is not part of the document: keep it out of Select All / copy */ + user-select: none; + -webkit-user-select: none; } .status-left, diff --git a/tests/e2e/select-all.spec.ts b/tests/e2e/select-all.spec.ts new file mode 100644 index 0000000..5232186 --- /dev/null +++ b/tests/e2e/select-all.spec.ts @@ -0,0 +1,63 @@ +/** + * E2E Tests: Select All scoping + * + * Cmd+A uses Electron's native `selectAll` role, which dispatches Blink's + * SelectAll command across the whole document. The app chrome (toolbar and + * status bar) lives in the same document as the rendered markdown, so without + * `user-select: none` on the chrome its text is selected and copied too. + * + * These tests drive the same Blink command the menu role dispatches and assert + * on the serialized selection. + */ +import { test, expect } from './electron-app'; + +const SAMPLE_MARKDOWN_HTML = '
Body paragraph text.
'; + +/** + * Render known content into the viewer, then run Blink's SelectAll and return + * the serialized selection. + */ +async function selectAllText(mainWindow: import('@playwright/test').Page): Promise