Closed Bug 623624 Opened 14 years ago Closed 13 years ago

Content elements don't get focus when the focus method is set on them

Categories

(Firefox for Android Graveyard :: General, defect)

x86
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: martijn.martijn, Assigned: vingtetun)

References

Details

(Keywords: testcase)

Attachments

(6 files, 4 obsolete files)

Attached file testcase1, focus input on load (obsolete) —
See upcoming testcase. In all cases, the element's background-color should be green on load or immediately after load.
This doesn't happen with Fennec at the moment.

This is more or less the opposite of the summary mentioned in bug 532738. Fwiw, I don't agree with the current summary of that bug ("Don't auto-focus input fields on page load").
Attached file testcase2, focus link on load (obsolete) —
Attachment #501702 - Attachment is obsolete: true
On first load, the elements don't get focus (FAIL), on reload they do get focus (PASS).
Also, closing the tab, then undo close tab, makes the tests fail.
Testcase #3 works for me on Android. I suspect we are not allowing the content
process to become "active" soon enough after a load. Which is why the
setTimeout testcase and the reloads work.
Depends on: 532738
There is a hack in Fennec code that removes focus on page load, see bug 532738, comment 11.

What I get with the stock Android browser on these testcases:
testcase 1: input doesn't become green, but I get an 'input focus' event logged. When tapping on the input, the input becomes green and another 'input focus' event gets logged.

testcase 2: link doesn't become green, but I get an 'input focus' event logged. Tapping on the link doesn't make it green, no 'input focus' event gets logged. Note that you get this result, if the first testcase wasn't carried out before. 

testcase 3: In short, same results as testcase 1.

testcase 4: The same results as testcase 3.

Note that this happens when the content page doesn't seem to have 'real' focus. If the content page does have focus, then you get the results as expected (except perhaps, that you can't focus links by tapping on them)

It doesn't matter if the hardware keyboard is opened or closed. The software keyboard doesn't show up when the page script is calling focus.

Ideally, Fennec should behave as expected, so untrusted focus events (from content script) shouldn't cause softkeyboard to appear.
Another case, where testcase 3 doesn't pass.
- Open testcase 3 in a new tab.
- Press reload on the newly opened tab with testcase 3.

Actually, I think this is one of the reasons why I see a lot of mochitest failures related to focus. If a tab/window, for some reason, doesn't have focus, there is no way to get it back (not by using the .focus() method, at least)
The activeRemoteFrame call has been added during the days we moved from a non-e10s world to an e10s world (bug 573041) and has survived in TapDown until now. I don't see a good reason for not moving this call to selectedTab?
Attachment #514498 - Flags: review?(mark.finkle)
Comment on attachment 514498 [details] [diff] [review]
Patch for activating the remote frame on tab switching

We need some test coverage on this ASAP.
Attachment #514498 - Flags: review?(mark.finkle) → review+
http://hg.mozilla.org/mobile-browser/rev/e230a8add766
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Backed out for a possible Ts regression:
http://hg.mozilla.org/mobile-browser/rev/01d357abf087
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Talos results from the backout indicate that this patch probably caused a 100ms (2%) regression in Ts.
Attached patch PatchSplinter Review
I'm unsure about the fact the regression is caused by browser.focus(); but it could be possible (strange things happened during startup!) so this patch remove this line
Assignee: nobody → 21
Attachment #521763 - Flags: review?(mark.finkle)
Comment on attachment 521763 [details] [diff] [review]
Patch

Make sure we watch for another regression
Attachment #521763 - Flags: review?(mark.finkle) → review+
http://hg.mozilla.org/mobile-browser/rev/5d77401196ed
Status: REOPENED → RESOLVED
Closed: 13 years ago13 years ago
Resolution: --- → FIXED
Ok, verified fixed on Fennec trunk on the Droid (and Windows desktop).
This is fixed for the case mentioned in comment 12, not for the original issue that I filed.
But that will be fixed by the fix for bug 532738 afaics, so I won't file a new bug for this, I'll just add a comment in there.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: