Only treat the platform's own chord as select-all - #15184
Open
ameyypawar wants to merge 2 commits into
Open
Conversation
macOS selects all with the command key and keeps Ctrl+A for "move to the start of the line", so accepting either modifier took that editing key away from every input and textarea in the app, the commit title, branch rename and new branch boxes among them. The platform comes from the backend, which reads it from the OS rather than from the user agent.
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.
🧠 Changes
isSelectAllChord()decides whether a keydown is the current platform's select-all chord, and the global handler in+layout.svelteuses it in place ofe.metaKey || e.ctrlKey. On macOS only ⌘ counts, everywhere else only Ctrl does. The platform comes frombackend.platformName, which the desktop app reads from the OS rather than from the user agent.Checked on macOS: Ctrl+A in the commit title now moves the cursor to the start of the line, and ⌘A still selects the field.
☕️ Reasoning
macOS text fields carry the emacs bindings, where Ctrl+A moves to the start of the line and Ctrl+E to the end. The handler hand-rolls select-all because Tauri gets in the way of the default behaviour, and it accepted either modifier, so on macOS Ctrl+A selected the whole field instead of moving the cursor. That takes an editing key away rather than adding a shortcut.
It only fires for
HTMLInputElementandHTMLTextAreaElement, which is why the report singles out the commit title, branch rename and new branch boxes while the commit message box behaves normally: that one is a Lexical contenteditable and never reaches this branch.Off macOS Ctrl+A is unchanged. Meta+A no longer selects, which was only reachable through the Super/Windows key.
🎫 Affected issues
Fixes: #11435