fix: exclude toolbar and status bar from Select All - #30
Open
FrankLedo wants to merge 1 commit into
Open
Conversation
Cmd+A uses Electron's native `selectAll` role, which dispatches Blink's SelectAll command across the entire document. The toolbar and status bar live in the same document as the rendered markdown, so their text was selected and copied along with the document content. Extends the `user-select: none` treatment already applied to `.file-name` to the `.toolbar` and `.status-bar` containers. Keeping this in CSS rather than replacing the menu role preserves native Cmd+A behaviour inside text inputs such as the find bar. Adds e2e coverage driving the same Blink command the menu role dispatches. Fixes ptheofan#29
FrankLedo
marked this pull request as ready for review
July 20, 2026 19:02
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.
Fixes #29.
Problem
Cmd+A selects the toolbar and status bar text along with the document, so copying afterwards puts app chrome in the clipboard.
{ role: 'selectAll' }(src/main/menu/applicationMenu.ts:79) is Electron's native role — it dispatches Blink's SelectAll across the whole document, and the chrome lives in the same document as the rendered markdown (index.html).Before the fix, the serialized selection was:
Fix
Extends the
user-select: nonetreatment already on.file-name(src/index.css:191) to the.toolbarand.status-barcontainers. That.file-namerule is why "No file open" was already absent from the selection above while "Open" and "Edit" were not — the mechanism was already in the codebase, just not applied to the containers.I deliberately kept this in CSS rather than replacing the menu role with a custom handler scoped to
#markdown-content. A custom handler would break native Cmd+A inside text inputs — notably the find bar, which mounts into#markdown-viewer(src/renderer.ts:182). The CSS approach leaves native selection semantics intact everywhere.Tests
Adds
tests/e2e/select-all.spec.ts, driving the same Blink command the menu role dispatches and asserting on the serialized selection: content is still selected, chrome is not. All three fail onmainand pass with the fix.Verified locally on macOS (arm64):
npm run lint: cleanNote for maintainer
Two things I hit that are outside this PR's scope:
#markdown-viewer, so its text is also caught by Select All while it is open. Same class of issue, separate fix — happy to open a follow-up if you want it.npm cileftnode_modules/electronwithout a completedist/(missingContents/Frameworks) and nopath.txt, soelectron.launchfailed until I re-extracted the cached zip withditto. May overlap with what Fix build environment and link handling for both internal anchors and links to local documents #28 is addressing.