Skip to content

Commit fc8f7f8

Browse files
committed
fix: allow keyboard shortcuts to work normally on the input fields
1 parent e61fff2 commit fc8f7f8

File tree

1 file changed

+19
-2
lines changed
  • src/extensionsIntegrated/CustomSnippets/src

1 file changed

+19
-2
lines changed

src/extensionsIntegrated/CustomSnippets/src/helper.js

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,23 @@ define(function (require, exports, module) {
468468
}
469469

470470
function validateAbbrInput(e, abbrBox) {
471+
// Allow keyboard shortcuts and navigation keys
472+
if (e.ctrlKey || e.metaKey || e.altKey) {
473+
return;
474+
}
475+
476+
// Allow navigation and function keys
477+
const allowedKeys = [
478+
'Backspace', 'Delete', 'Tab', 'Escape', 'Enter',
479+
'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown',
480+
'Home', 'End', 'PageUp', 'PageDown',
481+
'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10', 'F11', 'F12'
482+
];
483+
484+
if (allowedKeys.includes(e.key)) {
485+
return; // Allow these keys to work normally
486+
}
487+
471488
// Prevent space character
472489
if (e.key === ' ') {
473490
e.preventDefault();
@@ -487,8 +504,8 @@ define(function (require, exports, module) {
487504
return;
488505
}
489506

490-
// Check for character limit (30 characters)
491-
if (abbrBox.value.length >= 30 && e.key.length === 1) {
507+
// Check for character limit (30 characters) - only for printable characters
508+
if (abbrBox.value.length >= 30 && e.key.length === 1 && e.key.match(/[a-zA-Z0-9!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/)) {
492509
e.preventDefault();
493510

494511
// Determine if this is the edit form or new form

0 commit comments

Comments
 (0)