Fix missing caps lock events on iOS
Caps Lock on iOS only trigged key release or key press events. When it's clicked it would only send keydown, and next time it would only send keyup and so on. It should send both a key press and a key release. Also added the unit tests for macOS since those were missing. Co-Authored-By: Alex Tanskanen <aleta@cendio.se>
This commit is contained in:
committed by
Lauri Kasanen
parent
f1be4be653
commit
15c74e7dc9
@@ -162,7 +162,7 @@ export default class Keyboard {
|
||||
// state change events. That gets extra confusing for CapsLock
|
||||
// which toggles on each press, but not on release. So pretend
|
||||
// it was a quick press and release of the button.
|
||||
if (browser.isMac() && (code === 'CapsLock')) {
|
||||
if ((browser.isMac() || browser.isIOS()) && (code === 'CapsLock')) {
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
|
||||
stopEvent(e);
|
||||
@@ -274,7 +274,7 @@ export default class Keyboard {
|
||||
}
|
||||
|
||||
// See comment in _handleKeyDown()
|
||||
if (browser.isMac() && (code === 'CapsLock')) {
|
||||
if ((browser.isMac() || browser.isIOS()) && (code === 'CapsLock')) {
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', true);
|
||||
this._sendKeyEvent(KeyTable.XK_Caps_Lock, 'CapsLock', false);
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user