Closed
Bug 1164361
Opened 10 years ago
Closed 10 years ago
Input field maxlength is wrong with Chinese keyboard settings
Categories
(Core :: DOM: Editor, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: irena.kull, Unassigned)
References
()
Details
(Keywords: inputmethod, intl, testcase)
Attachments
(1 file)
1.23 KB,
text/html
|
Details |
User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.45 Safari/537.36
Steps to reproduce:
1. Open http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_input_maxlength
2. Enter more than 10 charcters
Actual results:
If you use Chinese input you can enter 11 characters, but the eleventh character will be deleted after focus-out.
If too many characters are entered, 2 on-input events are fired, so if application reacts on this event they get a longer string than allowed.
To prevent this 1 more character (this may happen in some other cases too). We introduces the javascript coding to remove it. What leads to the issue that Firefox clears the whole input field.
Expected results:
If you use Latin characters you can enter only 10 characters. Perfect! The same is expected for Chinese characters
Comment 1•10 years ago
|
||
How are you entering the text? In case of an IME, it's probably not possible to know the length until the user has finished composing. For example, IE 11 on Windows 7 will prevent the user from composing if the partial string exceeds maxlength, even though the resulting text may be shorter once finished. Opera 28 (and presumably Chrome) behaves the same as Firefox.
Reporter | ||
Comment 2•10 years ago
|
||
It works fine with Internet Explorer and Safari. It does not work with Chrome
Comment 3•10 years ago
|
||
As I said above, IE prevents entering text with IME if the uncommitted string exceeds maxlength. Take the attached testcase as an example. With the Microsoft Pinyin New Experience Input Style IME, type zhongwen1 then press Enter. In Firefox you enter 中文 while in IE you enter zh. Is the latter the behavior you're asking for in this bug report?
Updated•10 years ago
|
Reporter | ||
Comment 4•10 years ago
|
||
The text was entered via Latin keyboard with Chineese keyboard settings. In both browsers (IE and FF) if you enter e.g. zh you get one Chineese symbol. The problem occurs onlyl in FF when the string is longer than maxlength.
We expect FF to work as IE.
Comment 5•10 years ago
|
||
This is intentional behavior, as explained above plus bug 717600, comment 2.
Instead of input, you could watch for blur or change. Or compositionend specifically for IME input, though in that case Chrome returns how many characters were entered /before/ the text is truncated to fit in maxlength. All of these are in the previously attached testcase.
For details, refer to the MDN documentation. For web development help, refer to a site like Stack Overflow.
https://developer.mozilla.org/docs/Web/Events
http://stackoverflow.com
(In reply to irena.kull from comment #4)
> In both browsers (IE and FF) if you enter e.g. zh you get one Chineese symbol.
That's not the case, as I already detailed at comment 3. Also, the maxlength in the testcase is 2, so it must be possible to input that many characters, regardless of the language.
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•