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
It works fine with Internet Explorer and Safari. It does not work with Chrome
Created attachment 8606624 [details] maxlength-IME.html 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?
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.
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
Last Resolved: 4 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.