Skip to content

feat(defineShortcuts): add layoutIndependent option for keyboard shortcuts #4251

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: v3
Choose a base branch
from

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
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.

Add support for non-Latin keyboard layouts in defineShortcuts composable
1 participant