Closed Bug 560426 Opened 14 years ago Closed 14 years ago

Form fill interferes with custom input autocomplete arrow keys

Categories

(Firefox for Android Graveyard :: General, defect)

Fennec 1.1
x86
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: martijn.martijn, Assigned: vingtetun)

References

()

Details

(Whiteboard: formfill)

Attachments

(1 file)

To reproduce:
- go to google.com, after the page has loaded, click on the text input
- Type in a letter, for example the letter 'a'
- The formfill UI comes up, the page gets zoomed in on the text input and also the form autocomplete with suggestions from Google comes up.
- Press the arrow down key.

Expected result:
- The first autocomplete suggest entry is selected and the text input gets that value. The autocomplete 'popup' stays open and the focus stays in the text input.

Actual result:
- The first autocomplete suggest entry is selected and the text input gets that value, but soon afterwards the autocomplete 'popup' gets closed, and the focus is going to the "Google Search" button. The formfill UI is to blame for this.

This is also a problem on Wikipedia with the search.
Arrow key support was added in bug 522312. I suppose there is some way we could guess that the textbox has a fake dropdown list, but I don't think we can do it very reliably.
Whiteboard: formfill → formfill mobile-triage
Whiteboard: formfill mobile-triage → formfill
Attached patch PatchSplinter Review
This prevent using the override VK_DOWN/UP if the textbox has a autocomplete attribute to off (or similar for now, maybe the list is too much?) and has custom key listeners.
Attachment #455432 - Flags: review?(mark.finkle)
Comment on attachment 455432 [details] [diff] [review]
Patch

>diff -r d0c7ca14452e chrome/content/browser-ui.js

>diff -r d0c7ca14452e chrome/content/forms.js

>+  _els: Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci.nsIEventListenerService),
>+  _hasKeyListener: function _hasKeyListener(aElement) {
>+    let els = this._els;
>+    let listeners = els.getListenerInfoFor(aElement, {});
>+    for (let i = 0; i < listeners.length; i++) {
>+      let listener = listeners[i];
>+      if (["keyup", "keydown", "keypress"].indexOf(listener.type) != -1
>+          && !listener.inSystemEventGroup) {
>+        return true;
>+      }
>+    }
>+    return false;
>+  },

I don't like this part. Key events could be used for anything, not just fake auto-suggest UIs.

Let's drop this part.

>       case aEvent.DOM_VK_DOWN:
>-        if (currentElement instanceof HTMLTextAreaElement) {
>+        if (currentElement instanceof HTMLInputElement && !currentWrapper.canAutocomplete()) {
>+          if (this._hasKeyListener(currentElement))
>+            return;

Let's just drop the _hasKeyListener part.
Attachment #455432 - Flags: review?(mark.finkle) → review-
Comment on attachment 455432 [details] [diff] [review]
Patch

Change of heart. I missed the fact that the key listeners would not be called very often.
Attachment #455432 - Flags: review- → review+
http://hg.mozilla.org/mobile-browser/rev/57363b001117
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: