Skip to content

Fix Ctrl+A/C/X/V shortcuts in EditableText on non-Latin keyboard layouts#25056

Open
Farori wants to merge 1 commit into
bevyengine:mainfrom
Farori:fix-editable-text-shortcuts-non-latin
Open

Fix Ctrl+A/C/X/V shortcuts in EditableText on non-Latin keyboard layouts#25056
Farori wants to merge 1 commit into
bevyengine:mainfrom
Farori:fix-editable-text-shortcuts-non-latin

Conversation

@Farori

@Farori Farori commented Jul 18, 2026

Copy link
Copy Markdown

Objective

Fixes #24997.

Select All / Copy / Cut / Paste shortcuts in EditableText
(bevy_ui_widgets) don't work while a non-Latin keyboard layout (Cyrillic,
Greek, Hebrew, Arabic, ...) is active: the shortcuts were matched only
against the layout-dependent logical_key, so with e.g. a Russian layout
Ctrl+C arrives as Key::Character("с") and never matches "c".

Solution

Use the hybrid matching strategy approved in the issue (the convention used
by most toolkits and browsers):

  • match the layout-aware logical_key first, keeping AZERTY/QWERTZ/Dvorak
    shortcut conventions intact;
  • fall back to the physical key_code (KeyCode::KeyA/KeyC/KeyX/KeyV) when
    the logical key is not an ASCII character.

The check is extracted into a matches_edit_shortcut helper with unit tests.
Behavior for Named keys (arrows, Home/End, Backspace, ...) is unchanged,
and unmatched combinations still propagate.

Longer term, exposing winit's key_without_modifiers in bevy_input would
allow a more principled solution: #25055.

Testing

  • cargo run --example text_input on Windows 10 and Linux: with a
    Russian/Ukrainian layout active, Ctrl+A/C/X/V now work; on US QWERTY the
    behavior is unchanged; named-key shortcuts and plain text input are
    unaffected.
  • New unit tests for the helper: cargo test -p bevy_ui_widgets.
  • cargo run -p ci -- lints passes.

@github-actions

Copy link
Copy Markdown
Contributor

Welcome, new contributor!

Please make sure you've read our contributing guide, as well as our policy regarding AI usage, and we look forward to reviewing your pull request shortly ✨

@alice-i-cecile
alice-i-cecile requested review from Shatur and viridia July 18, 2026 17:34
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Input Player input via keyboard, mouse, gamepad, and more A-UI Graphical user interfaces, styles, layouts, and widgets D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in Input Jul 18, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in UI Jul 18, 2026
@alice-i-cecile alice-i-cecile added S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it and removed S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jul 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Input Player input via keyboard, mouse, gamepad, and more A-UI Graphical user interfaces, styles, layouts, and widgets C-Bug An unexpected or incorrect behavior D-Straightforward Simple bug fixes and API improvements, docs, test and examples S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it

Projects

Status: Needs SME Triage
Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

Text input Select All / Copy / Cut / Paste shortcuts don't work with non-Latin keyboard layouts

3 participants