Closed Bug 230648 Opened 21 years ago Closed 21 years ago

javascript focus() can steal focus from address bar

Categories

(Firefox :: General, defect)

x86
Linux
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 125282

People

(Reporter: bugzilla.mozilla.org, Assigned: bugzilla)

Details

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.
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.
Summary: Page with input field loads and steals focus from address bar → javascript focus() can steal focus from address bar

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