Closed Bug 276279 Opened 20 years ago Closed 20 years ago

Clicking label doesn't let control lose focus

Categories

(Core :: DOM: Events, defect)

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: pjj, Unassigned)

References

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a6) Gecko/20041227 Firefox/1.0+ Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a6) Gecko/20041227 Firefox/1.0+ I use <label>s for <form> elements (eg. <checkbox> or <radio>); to an element JavaScript is attached and when it is clicked, focuses on other element. The problem is that the blur() (and hence the focus(), too) doesn't work, if you click on the <label>. When you click on the element itself, it works as expected. Reproducible: Always Steps to Reproduce: 1. <checkbox> or <radio> with onclick event, using funtion with document.getElementById("some_other_element").focus(), plus a <label> 2. click on <label> 3. some_other_element is not focused Actual Results: The clicked element's focus was not removed (ie. nor blurring this element, neither focusing some_other_element didn't work). On the other hand, clicking _the_ element (and not the <label>) works as expected -- some_other_element is being focused. Expected Results: Clicking on <label> should work exactly like clicking on given element -- if clicking on element executes JavaScript blurring it or focusing another element, the same should be possible by clicking on element's <label>.
Attached file testcase (deleted) —
That does seem odd, though I don't understand events too well. Clicking either the label or the checkbox fires focus, click, change, change on the control, but when the label is clicked, the first change insists on taking focus back, so you get focus, click, change, focus, change.
Assignee: firefox → events
Component: General → DOM: Events
Product: Firefox → Core
QA Contact: firefox.general → ian
Summary: Clicking on label with JS:blur() attached doesn't blur the element → Clicking label doesn't let control lose focus
Version: unspecified → Trunk
The double "change" event is bug 254238
Depends on: 254238
OS: Windows 2000 → All
The patch in bug 146066 fixes this.
Depends on: 146066
Fixed by patch in bug 146066.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: