Skip to content

Commit

Permalink
fix(keyboard): add brackets ([]{}) to defaultKeyMap for keyboard()/…
Browse files Browse the repository at this point in the history
…type()
  • Loading branch information
bryan-codaio committed Jul 10, 2024
1 parent d036279 commit e521f50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/keyboard/keyMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export const defaultKeyMap: keyboardKey[] = [

// alphanumeric block - functional
{code: 'Space', key: ' '},
{code: 'BracketLeft', key: '['},
{code: 'BracketRight', key: ']'},
{code: 'BracketLeft', key: '{', shiftKey: true},
{code: 'BracketRight', key: '}', shiftKey: true},

{code: 'AltLeft', key: 'Alt', location: DOM_KEY_LOCATION.LEFT},
{code: 'AltRight', key: 'Alt', location: DOM_KEY_LOCATION.RIGHT},
Expand Down
8 changes: 4 additions & 4 deletions tests/keyboard/parseKeyDef.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,26 @@ cases(
},
'{ as printable': {
text: '{{',
keyDef: {key: '{', code: 'Unknown'},
keyDef: {key: '{', code: 'BracketLeft', shiftKey: true},
},
'{ as printable followed by descriptor': {
text: '{{{foo}',
keyDef: [
{key: '{', code: 'Unknown'},
{key: '{', code: 'BracketLeft', shiftKey: true},
{key: 'foo', code: 'Unknown'},
],
},
'{ as key with modifiers': {
text: '{\\{>5/}',
keyDef: {key: '{', code: 'Unknown'},
keyDef: {key: '{', code: 'BracketLeft', shiftKey: true},
},
'modifier as key with modifiers': {
text: '{/\\/>5/}',
keyDef: {key: '/', code: 'Unknown'},
},
'[ as printable': {
text: '[[',
keyDef: {key: '[', code: 'Unknown'},
keyDef: {key: '[', code: 'BracketLeft'},
},
},
)
Expand Down

0 comments on commit e521f50

Please sign in to comment.