Skip to content

fix(android): send Ctrl for the command modifier so cmd+a selects all - #480

Open
mobile-kevin wants to merge 1 commit into
mobile-next:mainfrom
mobile-kevin:fix-android-cmd-modifier
Open

mobile-kevin wants to merge 1 commit into
mobile-next:mainfrom
mobile-kevin:fix-android-cmd-modifier

Conversation

@mobile-kevin

@mobile-kevin mobile-kevin commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Problem

io keys documents cmd+a as select-all, but on Android the "command" modifier mapped to KEYCODE_META_LEFT. Meta+A opens the Google Assistant instead of selecting text, so cmd+a/cmd+c/cmd+v all did the wrong thing and yanked the app out of the foreground.

Fix

Android's primary shortcut modifier is Control, so map the canonical "command" modifier to KEYCODE_CTRL_LEFT. iOS still maps it to the Command key, where cmd+a already selects all. (cmd, command and meta all normalize to "command" upstream, so they now all send Ctrl on Android — matching the documented select-all semantics.)

Tests

  • Unit: command and control both map to KEYCODE_CTRL_LEFT, and command must not map to Meta.
  • Verified live on the emulator: typed text into a field, cmd+a + backspace cleared it, and the foreground stayed on the app (the Assistant no longer opened).

Summary by CodeRabbit

  • Bug Fixes
    • On Android, shortcuts using the Command modifier now map to the Control key, rather than the Meta key. This aligns Command shortcut behavior with the cross-platform mapping and helps shortcuts using Command work as expected on Android.

io keys documents cmd+a as select-all, but Android mapped the "command"
modifier to KEYCODE_META_LEFT. Meta+A opens the Google Assistant instead of
selecting text, so every documented cmd-based shortcut (select-all, copy,
paste) did the wrong thing and pulled the app out of the foreground.

Android's primary shortcut modifier is Control, so map "command" to
KEYCODE_CTRL_LEFT. iOS keeps mapping it to Command, where cmd+a already
selects all.
@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: mobile-next/mobilecli/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: f580895f-7764-46d7-8b33-aebf58db2ce2

📥 Commits

Reviewing files that changed from the base of the PR and between 1e88c68 and 3f16f8a.

📒 Files selected for processing (2)
  • devices/android.go
  • devices/android_keys_test.go

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Android’s command modifier now maps to KEYCODE_CTRL_LEFT instead of KEYCODE_META_LEFT. A test checks the commandandcontrol` mappings.

Changes

Android modifier mapping

Layer / File(s) Summary
Update and test the command mapping
devices/android.go, devices/android_keys_test.go
The command mapping changes to KEYCODE_CTRL_LEFT. The test checks that command and control map to KEYCODE_CTRL_LEFT and that command does not map to KEYCODE_META_LEFT.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~5 minutes

Change: Bug fix

Suggested reviewers: gmegidish

Merge Risk: ⚪ Minimal · up to 3f16f

Android command now uses Ctrl rather than Meta, with a focused test for the mapping. No concrete merge-blocking risk is established by the supplied context.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: mapping Android's command modifier to Ctrl so cmd+a selects all.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Comment @coderabbitai help to get the list of available commands.

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.

1 participant