Closed
Bug 1398374
Opened 8 years ago
Closed 8 years ago
Android Keyboard displays Next instead of Go (Works on Chrome)
Categories
(Firefox for Android Graveyard :: Keyboards and IME, enhancement)
Tracking
(firefox58 fixed)
RESOLVED
FIXED
Firefox 58
| Tracking | Status | |
|---|---|---|
| firefox58 | --- | fixed |
People
(Reporter: mkaply, Assigned: JanH)
References
()
Details
Attachments
(3 files)
When you navigate to this website on Fennec:
http://browserhome.net/
And enter text in the search field, the Android Keyboard shows "next". Clicking it simply navigates to the Facebook button.
On Chrome, the Android Keyboard has "Go" and clicking it searches properly on the website.
| Assignee | ||
Comment 1•8 years ago
|
||
notifyIMEContext (https://dxr.mozilla.org/mozilla-central/source/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoInputConnection.java#971) is being called with typeHint="text, modeHint="" and actionHint="next", so the problem is somewhere within Gecko's input handling (probably the IMEStateManager).
This is the markup for the search field:
> <div class="search-main clearfix">
> <input name="ie" value="UTF-8" type="hidden">
> <input name="brand" value="WIKO" type="hidden">
> <input class="input-hidden" type="text">
> <input value="" name="search_term" autocomplete="off" id="search-text" placeholder="What are you looking for?" type="text">
> </div>
If I delete the first three input nodes in the DOM Inspector, then notifyIMEContext is being called with actionHint="go" and pressing that button submits the search.
Component: General → Keyboards and IME
OS: Unspecified → Android
Hardware: Unspecified → All
| Assignee | ||
Comment 2•8 years ago
|
||
As far as I can tell, the difference in behaviour seems to happen because we default to an actionHint of "next" and only send something else (like "go" or "search") if the form has either a default submit element, or else if it is implicitly submittable [1].
Because for unknown reasons browserhome.net uses a second text <input> that is only hidden via "display: none", but not disabled, this means that as per the spec the search form is not implicitly submittable [2].
Chrome's algorithm on the other hand more or less seems to ignore submittability and (special handling for search fields and textareas aside) simply uses IME_ACTION_GO for the last input element of a form and IME_ACTION_NEXT for everything else [3]
[1] https://dxr.mozilla.org/mozilla-central/rev/57f68296c350469d73d788eb3695a898947b4acb/dom/events/IMEStateManager.cpp#1337
[2] https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#implicit-submission
[3] https://cs.chromium.org/chromium/src/content/public/android/java/src/org/chromium/content/browser/input/ImeUtils.java?l=146&rcl=fca18931b5ee2b1e272ba0e86ac98f4c10d12e05
| Assignee | ||
Updated•8 years ago
|
Assignee: nobody → jh+bugzilla
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 5•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8914127 [details]
Bug 1398374 - Part 2 - Send an IME actionHint other than "next" for the last input element of a form.
https://reviewboard.mozilla.org/r/185438/#review190416
::: dom/events/IMEStateManager.cpp:1340
(Diff revision 1)
> + // ... and does it only have a single text input element ?
> + if (!htmlForm->ImplicitSubmissionIsDisabled()) {
> - willSubmit = true;
> + willSubmit = true;
> + // ... or is this the last non-disabled element?
> + } else if (htmlForm->IsLastActiveElement(control)) {
> + willSubmit = true;
> + }
Why don't you just use || instead of else if? But up to you.
Attachment #8914127 -
Flags: review?(masayuki) → review+
| Comment hidden (mozreview-request) |
Comment 7•8 years ago
|
||
| mozreview-review | ||
Comment on attachment 8914126 [details]
Bug 1398374 - Part 1 - Add helper method to test for the last non-disabled single line form input.
https://reviewboard.mozilla.org/r/185436/#review190770
r=me with the loop iteration issue below fixed.
::: dom/html/HTMLFormElement.cpp:1848
(Diff revision 1)
> +{
> + NS_PRECONDITION(aControl, "Unexpected call");
> +
> + bool isLastActive = false;
> + uint32_t length = mControls->mElements.Length();
> + for (uint32_t i = length - 1; i >= 0; --i) {
i >=0 is always true; it's an unsigned type. So this loop doesn't have a useful loop-termination condition.
You need to do:
for (uint32_t i = length; i > 0; --i) {
auto* element = mControls->mElements[i-1];
or something. Or better yet:
for (auto* element : Reversed(mControls->mElements)) {
::: dom/html/HTMLFormElement.cpp:1852
(Diff revision 1)
> + if (element == aControl) {
> + isLastActive = true;
> + }
May be simpler to just do:
return element == aControl;
and after the loop return false and drop isLastActive altogether.
Attachment #8914126 -
Flags: review?(bzbarsky) → review+
| Assignee | ||
Comment 8•8 years ago
|
||
| mozreview-review-reply | ||
Comment on attachment 8914126 [details]
Bug 1398374 - Part 1 - Add helper method to test for the last non-disabled single line form input.
https://reviewboard.mozilla.org/r/185436/#review190770
> i >=0 is always true; it's an unsigned type. So this loop doesn't have a useful loop-termination condition.
>
> You need to do:
>
> for (uint32_t i = length; i > 0; --i) {
> auto* element = mControls->mElements[i-1];
>
> or something. Or better yet:
>
> for (auto* element : Reversed(mControls->mElements)) {
Ouch - thanks for catching that.
Also didn't know about the `Reversed()` trick, sound like a neat idea indeed.
| Comment hidden (mozreview-request) |
| Comment hidden (mozreview-request) |
Comment 11•8 years ago
|
||
Pushed by mozilla@buttercookie.de:
https://hg.mozilla.org/integration/autoland/rev/ca2a39919f2d
Part 1 - Add helper method to test for the last non-disabled single line form input. r=bz
https://hg.mozilla.org/integration/autoland/rev/2bde2497dd3f
Part 2 - Send an IME actionHint other than "next" for the last input element of a form. r=masayuki
Comment 12•8 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/ca2a39919f2d
https://hg.mozilla.org/mozilla-central/rev/2bde2497dd3f
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox58:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → Firefox 58
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•