Closed Bug 214368 Opened 21 years ago Closed 18 years ago

Label doesn't work when second label contains embedded checkbox

Categories

(Core :: Layout: Form Controls, defect)

x86
Windows XP
defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: rick, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file, 1 obsolete file)

891 bytes, text/html
Details
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5a) Gecko/20030718
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5a) Gecko/20030718

If you have two labels for one checkbox and one label encompasses the checkbox
in question, the first label doesn't work properly. I think this is wrong as
Opera and IE do what I expect (although I did read a bit in the HTML 4 spec
which made me think I was wrong, but I think it was regarding tables).

Reproducible: Always

Steps to Reproduce:
1. Load the testcase (will attach next post)
2. Click the first label
Actual Results:  
The checkbox wouldn't check

Expected Results:  
Checkbox should have checked
Attached file Testcase (obsolete) —
I've tested with textboxes, radios and selects too but they all seem to work
fine. I'm assuming it's because checkboxes are toggled on and off, and the
first label changes the checkbox state, then triggers the second label which
changes the state back to the original? Just a guess though, I'm probably
wrong!
So... the HTML spec is a little funky here.  Focusing a label should focus and
trigger its control.  OK.

When the control is focused, the focus event propagates up to the containing
label, triggering it.  Oops.

Perhaps we should bail out if the event target is in fact our target control? 
Aaronl?
OS: Windows XP → Mac System 7
OS: Mac System 7 → Windows XP
Boris, so is it checking and then unchecking it so fast that it looks like
nothing happened?

I don't think focusing a label should trigger its control at all - I though it
was the click event that triggers it. Or?
Aaron, as far as I can tell, that's what's happening (checking and 
unchecking).  If it's not supposed to trigger the control, then we have a 
problem - it does.
Whiteboard: DUPEME
Attached file Updated testcase
(In reply to comment #3)
> Boris, so is it checking and then unchecking it so fast that it looks like
> nothing happened?

I've updated the testcase to show an alert when the input's state is changed -
it appears as though comment 3 is correct.
Attachment #128821 - Attachment is obsolete: true
Keywords: testcase
(In reply to comment #5)
> Created an attachment (id=141172) [edit]
Hmm, when I click on label1 or label2 or the checkbox itself, the alert box pops up and the Checkbox is triggered. I think that's what it is expected to do?

Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20060531 Minefield/3.0a1
The patch for bug 146066 fixed this.
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Depends on: 146066
Resolution: --- → FIXED
Whiteboard: DUPEME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: