parent
6b3d53a795
commit
031caec406
|
@ -173,6 +173,7 @@ function unmapKeys (keyMap, keys, component) {
|
||||||
function acceptShortcutEvent (event) {
|
function acceptShortcutEvent (event) {
|
||||||
let { target } = event
|
let { target } = event
|
||||||
return !(
|
return !(
|
||||||
|
event.altKey ||
|
||||||
event.metaKey ||
|
event.metaKey ||
|
||||||
event.ctrlKey ||
|
event.ctrlKey ||
|
||||||
(event.shiftKey && event.key !== '?') || // '?' is a special case - it is allowed
|
(event.shiftKey && event.key !== '?') || // '?' is a special case - it is allowed
|
||||||
|
|
|
@ -15,6 +15,7 @@ function KeyDownEvent (key) {
|
||||||
this.metaKey = false
|
this.metaKey = false
|
||||||
this.ctrlKey = false
|
this.ctrlKey = false
|
||||||
this.shiftKey = false
|
this.shiftKey = false
|
||||||
|
this.altKey = false
|
||||||
this.target = null
|
this.target = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,4 +223,15 @@ describe('test-shortcuts.js', function () {
|
||||||
eventListener(new KeyDownEvent('a'))
|
eventListener(new KeyDownEvent('a'))
|
||||||
assert.ok(globalA.pressed())
|
assert.ok(globalA.pressed())
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('ignores alt key', function () {
|
||||||
|
let component = new Component()
|
||||||
|
|
||||||
|
addToShortcutScope('global', '1', component)
|
||||||
|
|
||||||
|
let event = new KeyDownEvent('1')
|
||||||
|
event.altKey = true
|
||||||
|
eventListener(event)
|
||||||
|
assert.ok(component.notPressed())
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue