Skip to content

fix: stop mac completion bindings from stealing backticks#8829

Merged
mscolnick merged 2 commits intomarimo-team:mainfrom
peter-gy:ptr/fix-backtick-typing-international-layout
Mar 23, 2026
Merged

fix: stop mac completion bindings from stealing backticks#8829
mscolnick merged 2 commits intomarimo-team:mainfrom
peter-gy:ptr/fix-backtick-typing-international-layout

Conversation

@peter-gy
Copy link
Copy Markdown
Contributor

@peter-gy peter-gy commented Mar 23, 2026

Summary

Fixes a macOS notebook editor bug where typing a backtick can trigger CodeMirror completion instead of inserting the character.

This affects international layouts that produce backtick through Alt/Option, including Hungarian Option+ű.

Details

The intended fix was already in place conceptually: marimo tries to remove the problematic Alt-` completion shortcut.

It seems like the bug was that the filter only checked binding.key, while upstream CodeMirror currently exposes this shortcut as a mac-specific binding:

{ mac: "Alt-`", run: startCompletion }

So the shortcut was never actually removed.
This PR changes the filter to check all platform-specific keybinding fields:

  • key
  • mac
  • linux
  • win

Tests

The follow-up test after GH Copilot review now checks the filtered bindings returned by completionKeymap() directly. Chose that over a jsdom event test because CodeMirror snapshots platform at module load, so a mac-only shortcut test there would be brittle and could pass for the wrong reason on non-mac CI.

@peter-gy peter-gy added the bug Something isn't working label Mar 23, 2026
Copilot AI review requested due to automatic review settings March 23, 2026 08:51
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Mar 23, 2026 9:35am

Request Review

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a macOS-specific CodeMirror completion keybinding conflict where `Alt/Option + `` can trigger completion instead of inserting a backtick (notably on international layouts).

Changes:

  • Updates completion keybinding filtering to consider platform-specific binding fields (key, mac, linux, win) rather than only binding.key.
  • Reworks the completion keymap unit tests to attempt to validate that `Alt-`` isn’t intercepted.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
frontend/src/core/codemirror/completion/keymap.ts Filters out problematic completion keybindings across platform-specific key fields.
frontend/src/core/codemirror/completion/tests/keymap.test.ts Adds/updates tests intended to cover the macOS `Alt-`` binding behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mscolnick mscolnick merged commit cde66ac into marimo-team:main Mar 23, 2026
26 checks passed
@github-actions
Copy link
Copy Markdown

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.21.2-dev34

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants