[web] Fix Altgr keyboard crash (#21781)

* Fix AltGr modifier crash
* update integration test
This commit is contained in:
Ferhat 2020-10-13 08:53:28 -07:00 committed by GitHub
parent 30bad27f53
commit d5c5a8ec61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -179,6 +179,21 @@ void main() {
'cancelable': true,
});
// Press and release AltGr key.
// Regression test for https://github.com/flutter/flutter/issues/58979.
dispatchKeyboardEvent(input, 'keydown', <String, dynamic>{
'key': 'AltGraph',
'code': 'AltRight',
'bubbles': true,
'cancelable': true,
});
dispatchKeyboardEvent(input, 'keyup', <String, dynamic>{
'key': 'AltGraph',
'code': 'AltRight',
'bubbles': true,
'cancelable': true,
});
// Press Tab. The focus should move to the next TextFormField.
dispatchKeyboardEvent(input, 'keydown', <String, dynamic>{
'key': 'Tab',

View File

@ -177,7 +177,7 @@ int _getMetaState(html.KeyboardEvent event) {
if (event.getModifierState('Shift')) {
metaState |= _modifierShift;
}
if (event.getModifierState('Alt')) {
if (event.getModifierState('Alt') || event.getModifierState('AltGraph')) {
metaState |= _modifierAlt;
}
if (event.getModifierState('Control')) {