Closed
Bug 38889
Opened 25 years ago
Closed 25 years ago
Click on label sends two onclicks to parent
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Core
DOM: UI Events & Focus Handling
Tracking
()
RESOLVED
INVALID
Future
People
(Reporter: jruderman, Assigned: pollmann)
Details
(Keywords: testcase)
Attachments
(1 file)
239 bytes,
text/html
|
Details |
Steps to reproduce: 1. Load attachment 2 [details] [diff] [review]. Click on label Expected result: one onclick for parent is recorded Actual result: two onclicks for parent are recorded note that the checkbox itself gets one onclick, but its container gets two.
Reporter | ||
Comment 1•25 years ago
|
||
Comment 2•25 years ago
|
||
This is XP -- mac/linux/win32 builds from today. See also bug #37262, where keypress events are begin generated twice.
OS: Windows 98 → All
Hardware: PC → All
Comment 3•25 years ago
|
||
I clicked on label and only one onclick was recorded using today's win32 build. Can somebody else please test this using 5-11-2000 builds or later.? I'll leave this open for some time...
Comment 4•25 years ago
|
||
Using this morning's comm. builds on win2k, redhat 6.1 and macos 9, when I click on the label, _two_ "onclick"s are written into the <textarea>. Are you using a debug build (vs. optimized)?
Comment 5•25 years ago
|
||
Okay, this shouldn't be too tough. The problem is that the label frame, which needs to redispatch the event to it child, is first allowing its normal processing to happen. So we end up bubbling up, then dispatching to the child, then bubbling up again. I'm not sure if there was a requirement for why events on the label object need to first be dispatched normally but I'll let pollmann figure that one out, its looks like he owns this code.
Assignee: joki → pollmann
Assignee | ||
Comment 6•25 years ago
|
||
I think this is actually the correct behaviour, unless there is a way to Tom, I'm not sure if I'm answering your question, but we need to do default processing because the label could have an onclick handler of it's own, per the HTML 4 spec: http://www.w3.org/TR/REC-html40/interact/forms.html#edef-LABEL And we have to bubble up an event for the form element that the label is FOR because that form element may have an onclick handler of it's own (bug I fixed, can't remember the number). So really, it is as if two events have happened in the parent, one on the label, and one on the element it is for. I wish there was a way to say "this is the same event", so they would be coalesced on the way up, but I'm not aware of any. Think of this case: <form> <p onclick="document.form.stuff.value='onclick paragraph 1\n' + document.form.stuff.value;"> <label for=checkboxFoo>label</label> </p> <p onclick="document.form.stuff.value='onclick paragraph 2\n' + document.form.stuff.value;"> <input id="checkboxFoo" type="checkbox"> </p> <textarea name=stuff></textarea> </form> I'm sure someone would complain if either "onclick paragraph 1" or "onclick paragraph 2" didn't appear. Since this seems like the right thing to me, I'm going to close this out. Please reopen if I'm wrong (tell me how it should be handled and also satisfy the above testcase), or if there is a way to coalesce separate events on the way up (same event, multiple targets). Thanks!
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → INVALID
Target Milestone: --- → Future
Comment 7•25 years ago
|
||
Mass update: changing qacontact to ckritzer@netscape.com
QA Contact: janc → ckritzer
Comment 9•24 years ago
|
||
Reassigning QA Contact for all open and unverified bugs previously under Lorca's care to Gerardo as per phone conversation this morning.
QA Contact: lorca → gerardok
Updated•23 years ago
|
QA Contact: madhur → rakeshmishra
Updated•22 years ago
|
QA Contact: rakeshmishra → trix
Updated•6 years ago
|
Component: Event Handling → User events and focus handling
You need to log in
before you can comment on or make changes to this bug.
Description
•