未验证 提交 d5c5a8ec 编写于 作者: F Ferhat 提交者: GitHub

[web] Fix Altgr keyboard crash (#21781)

* Fix AltGr modifier crash
* update integration test
上级 30bad27f
...@@ -179,6 +179,21 @@ void main() { ...@@ -179,6 +179,21 @@ void main() {
'cancelable': true, '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. // Press Tab. The focus should move to the next TextFormField.
dispatchKeyboardEvent(input, 'keydown', <String, dynamic>{ dispatchKeyboardEvent(input, 'keydown', <String, dynamic>{
'key': 'Tab', 'key': 'Tab',
......
...@@ -177,7 +177,7 @@ int _getMetaState(html.KeyboardEvent event) { ...@@ -177,7 +177,7 @@ int _getMetaState(html.KeyboardEvent event) {
if (event.getModifierState('Shift')) { if (event.getModifierState('Shift')) {
metaState |= _modifierShift; metaState |= _modifierShift;
} }
if (event.getModifierState('Alt')) { if (event.getModifierState('Alt') || event.getModifierState('AltGraph')) {
metaState |= _modifierAlt; metaState |= _modifierAlt;
} }
if (event.getModifierState('Control')) { if (event.getModifierState('Control')) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册