Skip to content

fix: normalize dead-key grave input in composer#3236

Open
StiensWout wants to merge 3 commits into
pingdotgg:mainfrom
StiensWout:fix/dead-key-grave-normalization-fresh
Open

fix: normalize dead-key grave input in composer#3236
StiensWout wants to merge 3 commits into
pingdotgg:mainfrom
StiensWout:fix/dead-key-grave-normalization-fresh

Conversation

@StiensWout

@StiensWout StiensWout commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Normalize dead-key grave look-alike composition input in the web composer before it reaches stored prompt text.
  • Reuse the existing selected-text backtick surround behavior and insert ASCII backticks for collapsed selections.
  • Replaces fix: normalize dead-key grave input in composer #3158 with a fresh branch based on current main.

Root cause

Some keyboard layouts emit grave-like Unicode characters (ˋ, , ) through insertCompositionText after a dead-key press. The composer accepted those literal characters, so Markdown inline-code delimiters were not recognized.

Impact

Dead-key grave input now produces ASCII backticks only at the input boundary. Pasted text and non-dead-key Unicode content are left unchanged.

Validation

  • PATH="$HOME/.vite-plus/bin:$PATH" vp check
  • PATH="$HOME/.vite-plus/bin:$PATH" vp run typecheck

vp check reports the repository's existing unrelated warnings and no errors.

Closes #3142


Note

Low Risk
Localized Lexical input-handling in the composer editor; no auth, data, or API changes.

Overview
Dead-key grave input on some keyboard layouts was inserting Unicode lookalikes (ˋ, , ) instead of ASCII backticks, so inline-code surround and Markdown delimiters broke.

ComposerSurroundSelectionPlugin now records plain Dead keydowns in a 1s window. When insertCompositionText delivers one of those lookalikes shortly after, it is handled as a backtick: existing surround-selected-text behavior runs when applicable, otherwise a single ` is inserted, and the lookalike is suppressed via preventDefault / propagation stops.

Modifier handling is centralized in hasCommandModifier (meta/ctrl). The dead-key tracking ref is cleared on other composition paths and normal surround handling so unrelated input is unchanged; paste and non-dead-key Unicode are not rewritten.

Reviewed by Cursor Bugbot for commit 6e83d9e. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Normalize dead-key grave input to backtick in composer surround-selection plugin

On macOS, pressing a dead-key grave (`) followed by a space produces a Unicode grave-lookalike character instead of a literal backtick, breaking the surround-selection feature in ComposerPromptEditor.

  • Tracks the timestamp of a plain Dead keydown in recentDeadKeyDownRef to create a 1-second detection window.
  • In onBeforeInput, intercepts insertCompositionText events where the data is a grave-accent lookalike character and a recent dead-key was recorded, then substitutes a literal ` and applies surround insertion if a selection is pending.
  • Suppresses the default browser input of the lookalike character via preventDefault and stopImmediatePropagation.
  • Adds hasCommandModifier and hasRecentDeadKeyDown helpers to unify modifier checks and dead-key age tests.

Macroscope summarized 6e83d9e.

StiensWout and others added 2 commits June 20, 2026 07:54
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 860a17da-09d6-445d-84e2-46f6a3d68f67

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added the vouch:unvouched PR author is not yet trusted in the VOUCHED list. label Jun 20, 2026
@github-actions github-actions Bot added the size:M 30-99 changed lines (additions + deletions). label Jun 20, 2026
Comment thread apps/web/src/components/ComposerPromptEditor.tsx
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward bug fix that normalizes dead-key grave characters to backticks in the composer input. Changes are self-contained to event handling logic in one component with clear intent and limited scope.

You can customize Macroscope's approvability policy. Learn more.

Co-authored-by: Codex <codex@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Inline code typed on dead-key keyboard layouts renders literally (non-ASCII grave instead of U+0060)

1 participant