Using input element inside a label element -> focus for input element gets lost when you click in it

RESOLVED DUPLICATE of bug 213519

Status

()

RESOLVED DUPLICATE of bug 213519
14 years ago
12 years ago

People

(Reporter: s.stock, Unassigned)

Tracking

({testcase})

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

(Reporter)

Description

14 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b3) Gecko/20050712 Firefox/1.0+

I am using an input element inside an label element which is linked with an
radio button. When I click on the input element the focus is set to the radio
button - not to the input element. So I can't enter any values.

Reproducible: Always

Steps to Reproduce:
1.open attached example
2.click on the input element
3.

Actual Results:  
focus is set to radio button


Expected Results:  
focus should be set to input element
(Reporter)

Comment 1

14 years ago
Created attachment 191579 [details]
bug showcase
The label has attribute for="IsAvailableDate", so the focus goes to the form
element with that id, which happens to be the radio button. When you remove that
for attribute, everything should work ok.
(Reporter)

Comment 3

14 years ago
Yes this works, but I want the radio button to be "checked" when I click into
the input element. Anyway I expected the focus to stay on the input element.

Maybe it's not a bug but a feature wish... I used some JavaScript to get this
behavior and this is ok for me.
No, when you use the for attribute, the focus is shifted to the associated element:

http://www.w3.org/TR/html401/interact/forms.html#h-17.9.1
"When a LABEL element receives focus, it passes the focus on to its associated
control. See the section below on access keys for examples."

So, you'll going to have to use javascript.

Comment 5

13 years ago
Created attachment 197300 [details]
Example code producing behavior

Snippet of HTML code from Collegeboard.com which produces the bug.  Clicking
inside the input element moves focus to the radio button and makes it (nearly)
impossible to type in the input (text) box.

Comment 6

13 years ago
May be a Gecko bug?
Confirmed in both Windows 2000 and Windows XP Pro SP2.

This should be labeled as a MAJOR bug, because when it shows up, it's serious. 
Even though it's technically, and arguably, the fault of whosever HTML it was.

Comment 7

13 years ago
Confirmed in Win XP - Firefox 1.5Beta1
see bug 296135 comment 6
Summary: Using input element inside a label element -> focus for input element gets lost when you click on it → Using input element inside a label element -> focus for input element gets lost when you click in it
i can reproduce this bug with the testcase on Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9a6pre) Gecko/2007060704 Minefield/3.0a6pre - so confirmed
Status: UNCONFIRMED → NEW
Component: General → Event Handling
Ever confirmed: true
Keywords: testcase
Product: Firefox → Core
QA Contact: general → events
Status: NEW → RESOLVED
Last Resolved: 12 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 213519
You need to log in before you can comment on or make changes to this bug.