Closed Bug 717600 Opened 9 years ago Closed 4 years ago
Maxlength attribute is ignored for typed characters with the vkb (even when composition string is committed)
See first text input on http://miketaylr.com/pres/html5/forms2.html Steps to reproduce: - Tap on first text input, vkb comes up - Type more than 6 characters in the text input Expected result: - No more text should appear than the first 6 characters Actual result: - All the text shows up that has been typed, even after the 6th character With the context menu, the pasted text is cut off to 6 characters, so there it is not ignored.
I believe this is related to the editor. Though, we are going to make that behavior the normal behavior with bug 613016.
Depends on: 613016
This is not a bug. The composition string must not be cut off by maxlength attribute because Japanese IME needs to be able to convert longer unconverted text to shorter converted text. (bug 98434) nsEditor cuts off when the composition string is committed.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Not happening on the LG Optimus Black. The committed composition string is longer than 6 characters here.
Isn't the *committed* string shrunk to the maxlength? If so, it's a bug, but I'm not sure why I cannot reproduce it on desktop Fx. nsEditor does handle the maxlength attribute.
Here is the implementation: http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/text/nsTextEditRules.cpp#606
Okay, I confirmed it. The committed string isn't shrunk to the maxlength on Android.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Summary: Maxlength attribute is ignored for typed characters with the vkb → Maxlength attribute is ignored for typed characters with the vkb (even when composition string is committed)
Hmm, that's strange, if typing without IME, maxlength does work fine.
So, IsIMEComposing() return true here, right? <http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/text/nsTextEditRules.cpp#1195> No wonder we don't truncate insertion then! I don't see the code responsible for doing the truncation when committing...
cc'ing Alexp. Maybe he might be able to get some input.
Committing string shouldn't have any information of clauses of composition string. When nsEditor receives such text event, nsEditor::mIsIMEComposing becomes false. http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/base/nsEditor.cpp#4379 http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/base/nsEditor.cpp#4349 http://mxr.mozilla.org/mozilla-central/source/editor/libeditor/text/nsPlaintextEditor.cpp#978 nsWindow for Android might set some clause information for commit event. http://mxr.mozilla.org/mozilla-central/source/widget/android/nsWindow.cpp#1950
I'm not sure if I understand comment 11. What I was trying to say in comment 9 is that I think we should look at the maxlength property and truncate the insertion if needed when committing an IME transaction. Do you agree?
Assignee: nobody → alexp
tracking-fennec: --- → +
Priority: -- → P4
Assignee: cpeterson → nobody
Status: REOPENED → NEW
latest build seems cannot reproduce.
Status: NEW → RESOLVED
Closed: 9 years ago → 4 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.