Input field maxlength is wrong with Chinese keyboard settings




4 years ago
4 years ago


(Reporter: irena.kull, Unassigned)


({inputmethod, intl, testcase})

38 Branch
inputmethod, intl, testcase

Firefox Tracking Flags

(Not tracked)




(1 attachment)



4 years ago
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 
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

4 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.
Component: Untriaged → Editor
Product: Firefox → Core

Comment 2

4 years ago
It works fine with Internet Explorer and Safari. It does not work with Chrome

Comment 3

4 years ago
Created attachment 8606624 [details]

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?


4 years ago
Keywords: inputmethod, intl, testcase

Comment 4

4 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

4 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.

(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.
Last Resolved: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.