javascript focus() can steal focus from address bar

VERIFIED DUPLICATE of bug 125282

Status

()

Firefox
General
VERIFIED DUPLICATE of bug 125282
14 years ago
13 years ago

People

(Reporter: Haukur Hreinsson, Assigned: Blake Ross)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031225 Firebird/0.7
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031225 Firebird/0.7

In general, when a page containing an input field (or presumably any focusable
embedded object) loads, it takes the keyboard focus, but that's not always
appropriate.

Reproducible: Always

Steps to Reproduce:
1. Set start page to something with an input field (http://google.com).
2. Open a new browser window.
3. In the new window, focus the address bar and start typing an URL into it.

Actual Results:  
While typing the URL, the start page finished loading and the keyboard focus was
transferred to the google search fiels, where the rest of my URL ended up
because I wasn't looking and continued to type. Still not looking, I pressed
enter and performed a google search on a partial url. The partial url in the
address bar was replaced as the search results loaded and was lost.

Expected Results:  
Keyboard focus remains in the address bar, where I'm busily entering an url.

This doesn't really have anything to do with the start page or new windows, it's
just that those are the elements that usually combine to trigger the bug. It's
common to quickly press ctrl-n, ctrl-l, and start typing an url. The bug forces
you to slow down or change start pages.

Comment 1

14 years ago
If I understand what you're reporting, this is INVALID.

Google (and many other pages) use a JavaScript trick to focus the search box on
load.  You can see this for yourself by viewing the source.  This function is
called when the page loads:

function sf(){document.f.q.focus();}

Contrast this behavior with Yahoo's home page, which doesn't take the focus.

Updated

14 years ago
Summary: Page with input field loads and steals focus from address bar → javascript focus() can steal focus from address bar

Comment 2

14 years ago

*** This bug has been marked as a duplicate of 125282 ***
Status: UNCONFIRMED → RESOLVED
Last Resolved: 14 years ago
Resolution: --- → DUPLICATE
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.