focus() puts cursor at end of input field containing a value




11 years ago
8 years ago


(Reporter: atiitto, Unassigned)




Firefox Tracking Flags

(Not tracked)





11 years ago
User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Build Identifier:

At username must be typed before "" and every time logging to the website, keyboard pointer points to the end of the full username. Let "_" indicate keyboard pointer. So, user name box looks like this every time entering to the website: @luukku.com_

Pushing "Home"-button must be done before typing the username. This never happens with Opera and Internet Explorer.

Reproducible: Always

Steps to Reproduce:
1. Refresh the website
2. ...or type the URL to the URL-box and press enter.
Actual Results:  
Problem appears.

Expected Results:  
To put keyboard pointer to the beginning of the username-box, like IE and Opera does.
This bug was originally reported on Firefox 2.x or older, which is no longer supported and will not be receiving any more updates. I strongly suggest that you update to Firefox 3.6.6 or later, update your plugins (flash, adobe, etc.), and retest in a new profile. If you still see the issue with the updated Firefox, please post here. Otherwise, please close as RESOLVED > WORKSFORME
Whiteboard: [CLOSEME 2010-07-30]
Version: unspecified → 2.0 Branch

Comment 2

8 years ago
This bug is still present in Firefoxx version 3.6.6.


8 years ago
Whiteboard: [CLOSEME 2010-07-30]
Version: 2.0 Branch → 3.6 Branch

Comment 3

8 years ago
IE and Opera do put pointer at start of field. Safari and Chrome highlight the text in the field. Might make sense if FF did one or the other...


8 years ago
Summary: At keyboard pointer points to wrong place → JS: focus() puts cursor at end of input field containing a value
Component: General → DOM: Core & HTML
OS: Windows XP → All
Product: Firefox → Core
QA Contact: general → general
Hardware: x86 → All
Version: 3.6 Branch → Trunk
Ever confirmed: true
Keywords: testcase
Summary: JS: focus() puts cursor at end of input field containing a value → focus() puts cursor at end of input field containing a value
I really wonders why we should put the cursor at the beginning of the input field?
Can't you use the selection API if you want the cursor to be at a specific position? Like setSelectionRange(0,0);

You can try this:
data:text/html,<body onload="var i=document.getElementsByTagName('input')[0]; i.focus(); i.setSelectionRange(0,0);"><input value="foo">

Comment 5

8 years ago
This is WONTFIX, I think.  If you need specific positioning, you should use setSelectionRange or a similar API.
WONTFIX it is then.
Last Resolved: 8 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.