parent
3a2fe740c1
commit
65524105f9
|
@ -107,7 +107,7 @@ export function onKeyDownInShortcutScope (scopeKey, event) {
|
|||
}
|
||||
|
||||
function handleEvent (scopeKey, keyMap, key, event) {
|
||||
const value = keyMap[key]
|
||||
const value = keyMap[key] || keyMap[key.toLowerCase()] // treat uppercase and lowercase the same (e.g. caps lock)
|
||||
if (!value) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -235,4 +235,16 @@ describe('test-shortcuts.js', function () {
|
|||
eventListener(event)
|
||||
assert.ok(component.notPressed())
|
||||
})
|
||||
|
||||
it('works with caps lock on', function () {
|
||||
const lmn = new Component()
|
||||
|
||||
addToShortcutScope('global', 'z', lmn)
|
||||
|
||||
assert.strictEqual(lmn.eventCount, 0)
|
||||
eventListener(new KeyDownEvent('z'))
|
||||
assert.strictEqual(lmn.eventCount, 1)
|
||||
eventListener(new KeyDownEvent('Z'))
|
||||
assert.strictEqual(lmn.eventCount, 2)
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue