Element UI version
2.4.11 (updating to 2.6 doesn't fix)
OS/Browsers version
Android 9 - Chrome
Vue version
2.5.16 (updating to 2.6 doesn't fix)
Reproduction Link
https://jsfiddle.net/p20gfmos/
Steps to reproduce
- Use an el-input on a Android device (android 8+) with gBoard keyboard
- Type something in the input
What is Expected?
The value of the input is immediately displayed under it in a div.
What is actually happening?
The input
instance value is not updated on keypress. It's only updated on blur or if the space key is pressed.
When debugging a bit, I realized the input event wasn't fired by element because this.isOnComposition
is true in the keypress listener.
I tried on several android phones and simulators and I can reproduce with every Android 8+ devices using gBoard. If I use another keyboard like SwiftKey, it works fine.
8条答案
按热度按时间kyxcudwk1#
Does using native input and v-model gives the desired result. If not, we won't fix it.
ecfdbz9o2#
Yes it works fine with a native input, that's why I suppose the bug is related to element-ui.
I checked the source code. The method
handleInput
of the el-input is correctly called. But noinput
event is emitted from el-input becausethis.isOnComposition
is true. And I haven't check the code related to composition but I guess the bug is in there.bakd9h0s3#
Ok, after some debugging here is what happens on an android 9 phone with gBoard keyboard :
compositionstart
is firedelement/packages/input/src/input.vue
Line 277 in c1b869d
| | this.isOnComposition=!isKorean(lastCharacter); |
because my keyboard is not korean
handleInput
doesn't emitinput
event because of this line :element/packages/input/src/input.vue
Line 286 in c1b869d
| | if (this.isOnComposition) return; |
compositionend
is fired only on blur or when the space key is pressed, then theinput
event is correctly firedSo clearly this is strange, as I believe
compositionstart
should NOT be fired.On a "working" keyboard like SwiftKey, composition events are only fired when the space key is pressed (
start
then immediatlystop
).I think I'll fork the project and remove composition event listeners as a quick workaround.
I have no experience with composition so I don't really know what it's for, but I need a quickfix because all inputs in my app are broken on android (with gBoard) now.
dly7yett4#
The design is not to emit input event during composition. So I guess it’s likely gBoard’s design issue.
We won’t change mainline code because we need to support CJK IMEs. Though you are welcomed to find a workaround that detects gBoard and hack the composition events a little bit.
I would also recommend you ask gBoard team why they choose to handle English words as character compositions.
ercv8c1e5#
Ok, after some debugging here is what happens on an android 9 phone with gBoard keyboard :
compositionstart
is firedbecause my keyboard is not korean
handleInput
doesn't emitinput
event because of this line :compositionend
is fired only on blur or when the space key is pressed, then theinput
event is correctly firedSo clearly this is strange, as I believe
compositionstart
should NOT be fired.On a "working" keyboard like SwiftKey, composition events are only fired when the space key is pressed (
start
then immediatlystop
).I think I'll fork the project and remove composition event listeners as a quick workaround.
I have no experience with composition so I don't really know what it's for, but I need a quickfix because all inputs in my app are broken on android (with gBoard) now.
element/packages/input/src/input.vue
Line 286 in c1b869d
| | if (this.isOnComposition) return; |
change this line to:
kulphzqa6#
Can we assume that composing may last up to 0.6s:
The idea is to emit the event if there are no changes while composing after a certain time.
Also, on my Gboard of Android, the
input
event is never triggered, even when using a composition language input (Vietnamese)6rqinv9w7#
The design is not to emit input event during composition. So I guess it’s likely gBoard’s design issue.
We won’t change mainline code because we need to support CJK IMEs. Though you are welcomed to find a workaround that detects gBoard and hack the composition events a little bit.
I would also recommend you ask gBoard team why they choose to handle English words as character compositions.
Would it be better if el-input will forward the composing events to the parent, so the caller can choose what to do with his business logic?
xqnpmsa88#
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.