Skip to content

Conversation

al1maher
Copy link

@al1maher al1maher commented May 29, 2025

Add optional layoutIndependent flag to defineShortcuts composable that enables layout-agnostic keyboard shortcuts by using KeyboardEvent.code instead of KeyboardEvent.key.

🔗 Linked issue

Closes: #2293

❓ Type of change

  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • 📖 Documentation (updates to the documentation or readme)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

When enabled, shortcuts work consistently across different keyboard layouts (Arabic, Hebrew) by matching physical key positions rather than character values.

Usage:

  • layoutIndependent: false (default) - uses e.key for character-based matching
  • layoutIndependent: true - uses e.code for physical key matching

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

amaher added 4 commits May 29, 2025 14:29
Add optional layoutIndependent flag to defineShortcuts composable that enables
layout-agnostic keyboard shortcuts by using KeyboardEvent.code instead of
KeyboardEvent.key.

When enabled, shortcuts work consistently across different keyboard layouts
(Arabic, Hebrew) by matching physical key positions rather than
character values.

Usage:
- layoutIndependent: false (default) - uses e.key for character-based matching
- layoutIndependent: true - uses e.code for physical key matching

Breaking change: When layoutIndependent is true, shortcut definitions must
use physical key codes (e.g., 'ctrl_KeyS' instead of 'ctrl_s').

Closes: nuxt#2293
Copy link

pkg-pr-new bot commented May 29, 2025

npm i https://pkg.pr.new/@nuxt/ui@4251

commit: 04497e1

@al1maher al1maher changed the title feat: add layoutIndependent option for keyboard shortcuts feat(defineShortcuts): add layoutIndependent option for keyboard shortcuts May 29, 2025
@benjamincanac benjamincanac self-requested a review as a code owner June 6, 2025 10:28
@niusia-ua
Copy link

I would very like to have this implemented!

@benjamincanac
Copy link
Member

@smarroufin What do you think of this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 #1289
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for non-Latin keyboard layouts in defineShortcuts composable
3 participants