Closed Bug 374881 Opened 13 years ago Closed 13 years ago

textbox.focus() causes Up, Down, Page Up, Page Down, Home and End keys to not function on other sites.

Categories

(Firefox :: Keyboard Navigation, defect)

x86
Windows XP
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: dustans, Assigned: mano)

References

(Blocks 1 open bug)

Details

(Keywords: regression, verified1.8.1.4)

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.3) Gecko/20070309 Firefox/2.0.0.3

Happens with: Firefox 2.0.0.2 and 2.0.0.3
Does not happen with: Firefox 2.0.0.1 and previous version
Installation: Clean
Profile: New
Extensions: None

The problem IS definitely caused by the way Google has the cursor automatically inserted into the text box. The Google Firefox start page is default in Firefox. After starting the browser and visiting any site after, the navigation keys do not work at all. Visiting Google from your bookmarks has the same result, so it does not have to be set as the default start page to reproduce this, but it must be in the bookmarks.

Reproducible: Always

Steps to Reproduce:
1. Add www.google.com to your bookmarks
2. Add www.broadbandreports.com to your bookmarks
(Note: The addresses must be added to bookmarks; typing in location/address bar will fail to reproduce this issue)
3. Close Firefox
4. Start Firefox
5. Click on www.google.com from your bookmarks
6. DO NOT type in the Google search box or click anywhere
7. Click on www.broadbandreports.com from your bookmarks
8. Try Up, Down, Page Up, Page Down, Home and End keys

This would also be reproducible by having Google (or Firefox start page) as your default start page. Start the browser, then simply click on Broadband Reports in the bookmarks and this will also reproduce just the same. It does not have to be Broadband Reports site either, it can be ANY site that has the vertical scroll bar.
Actual Results:  
The navigation keys mentioned above do not work on any other site.

Expected Results:  
The navigation keys should still work. The Google text box somehow steals focus. This has always worked perfectly with Firefox 2.0.0.1 and previous versions, but has not worked since 2.0.0.2.

- The Google text box somehow steals focus. Typically when focus has been taken this way, you would be able to click on the background of the web page to bring focus back and allow the navigation keys to work as per normal. However, that is not the case with this. The only work-around is to click in the text box, then click on the background or by typing something into the text box.

- Another work-around in this scenario is by going to Google, then to Broadband Reports and clicking in the Username, Password or Search box at the top of their site, then clicking on the background of the site. The keys will then start working again.

- This is definitely an issue caused by Google's automatic insertion of the cursor into their search text box.
Summary: Automatic cursor insertion into text box (Google search / Firefox start page) causing Up, Down, Page Up, Page Down, Home and End keys to not function on other sites. → textbox.focus() causes Up, Down, Page Up, Page Down, Home and End keys to not function on other sites.
I just wanted to reiterate the fact that this issue is "out-of-the-box" on Firefox 2.0.0.2 and 2.0.0.3 simply because the default start page is that Google Firefox page. Brand new, clean installation, new profile will reproduce this issue right from the get-go.
This is a regression between 2006-09-19 07 and 2006-09-19 11.
http://bonsai.mozilla.org/cvsquery.cgi?module=PhoenixTinderbox&date=explicit&mindate=2006-09-19+06%3A00&maxdate=2006-09-19+12%3A00

On branch it regressed  between the nightlies of 15 and 16 Jan 2007, which seems to point to Bug 286933.
Blocks: 286933
Keywords: regression
Duplicate of this bug: 374848
More info:

This does NOT reproduce at www.hotmail.com

Google and Hotmail both have the cursor automatically inserted into the text box and visually appears the same. However, this is reproducible only on Google and not with Hotmail. I would assume that they both use different methods to insert the cursor.

Hopefully this last bit of information will help narrow down the specific problem.
Temporary fix:

I saved an HTML copy of http://www.google.ca/firefox to my hard drive to set as default start page. I removed the code that was causing the problem, and now it has fixed the problem.

This code may also assist in narrowing down this problem.

<script type="text/javascript"><!--
function sf(){document.f.q.focus();}
// -->
</script>
Confirming based on Ria finding a regression range.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: blocking1.8.1.4?
I have since tested 3 or 4 different sites that have the cursor automatically inserted into the text box. This problem still only appears with Google. Therefore, any developers looking to create a fix for this, it definitely has something to do with that bit of javascript above used by Google and somehow Firefox 2.0.0.2 and 2.0.0.3 do not deal with it properly as prior versions of Firefox had always worked properly with this.

I haven't been running Linux for a while now.
Can anybody confirm if this also affects Linux users?
Attached patch patch?Splinter Review
This fixes it, but it is really a hack. But I think this is safe for the branch.
nsFormFillController::Unload doesn't seem to get called at all when a new page gets loaded. (btw, it seems to me that should happen on the pagehide event, not the unload event)
Attachment #259408 - Flags: review?(mano)
Flags: blocking1.8.1.4? → blocking1.8.1.4+
Duplicate of this bug: 376045
Assignee: nobody → mconnor
Comment on attachment 259408 [details] [diff] [review]
patch?

I would like to just back out the original patch for now, at least on the branch.
Attachment #259408 - Flags: review?(mano)
a=dveditz for backing out bug 286933. Please remove "fixed1.8.1.2" from that bug when you have.
Assignee: mconnor → mano
done.
Status: NEW → RESOLVED
Closed: 13 years ago
Keywords: fixed1.8.1.4
Resolution: --- → FIXED
(In reply to comment #10)
> I would like to just back out the original patch for now, at least on the
> branch.

Ok, but there really seems to be something fundamentally wrong with nsFormFillController::Unload not be called at all. Should I file a new bug on that?
yes, please do, and cc me (please also set some blocking flags, it seems to me like it may cause leaks and/or crashes).
verified fixed 1.8.1.4 using the steps to reproduce from comment #0 on Build identifier: Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.4pre) Gecko/2007042805 BonEcho/2.0.0.4pre and Up, Down, Page Up, Page Down, Home and End keys are working -> adding verified keywords.
You need to log in before you can comment on or make changes to this bug.