Ignore keyevents during text composition (#7205)
KeyboardEvent.key may be physical key name (Escape, Tab, etc.) even in text composition and it causes hotkeys or suggestion selection. So we need to check e.which or e.isComposing. Checking e.which also allows us to avoid Esc key on compositionend in Safari.lolsob-rspec
parent
0939d9ede6
commit
456fff2bba
|
@ -84,6 +84,12 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.which === 229 || e.isComposing) {
|
||||||
|
// Ignore key events during text composition
|
||||||
|
// e.key may be a name of the physical key even in this case (e.x. Safari / Chrome on Mac)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(e.key) {
|
switch(e.key) {
|
||||||
case 'Escape':
|
case 'Escape':
|
||||||
if (suggestions.size === 0 || suggestionsHidden) {
|
if (suggestions.size === 0 || suggestionsHidden) {
|
||||||
|
|
Loading…
Reference in New Issue