Can't check checkbox when within an <a href>
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P3)
Tracking
()
People
(Reporter: tbornholtz, Unassigned)
References
(Blocks 1 open bug)
Details
In the following html I cannot check the checkbox. If I click to check it, it will take me to the href url. <A HREF="http://www.mozilla.org"> <INPUT TYPE=checkbox NAME="myname" VALUE="myvalue">Click Me</A> IE 5.5 will let me check the checkbox. I know that this is bad HTML, but Lotus Domino R5 generated it, so there is a potential to see this in the real world. BTW, I'm using build 2000110804.
Comment 1•24 years ago
|
||
The HTML seems to be valid according to the HTML 4.01 spec. From http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-flow-cancelation: ------------- Some events are specified as cancelable. For these events, the DOM implementation generally has a default action associated with the event. An example of this is a hyperlink in a web browser. When the user clicks on the hyperlink the default action is generally to active that hyperlink. Before processing these events, the implementation must check for event listeners registered to receive the event and dispatch the event to those listeners. These listeners then have the option of canceling the implementation's default action or allowing the default action to proceed. In the case of the hyperlink in the browser, canceling the action would have the result of not activating the hyperlink. Cancelation is accomplished by calling the Event's preventDefault method. If one or more EventListeners call preventDefault during any phase of event flow the default action will be canceled. Different implementations will specify their own default actions, if any, associated with each event. The DOM does not attempt to specify these actions. ------------------- so the DOM spec also does not say anything one way or the other about Mozilla's behavior in this case. It seems to me that the user would expect checking/unchecking the checkbox to take precedence over the link being followed. Confirming. Over to event handling, since the checkbox should prevent the event being bubbled to the link
Comment 2•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.
Comment 3•24 years ago
|
||
It's probably not too hard to make this work, although I think that this HTML is confusing at best. If you look you'll notice that the checkbox does in fact change state, we just also load this link. And since the checkbox is, in fact, inside the link, one has to wonder what the intent really is. Unfortunately I think its not quite as simple as not bubbling the event, however, since code on the web page could be waiting for that event to bubble up and wonder why it's losing it. For now I'm going to mark it future and if I have time I'll get back to it soon. This bug has been marked "future" because the original netscape engineer working on this is over-burdened. If you feel this is an error, that you or another known resource will be working on this bug,or if it blocks your work in some way -- please attach your concern to the bug for reconsideration.
Question, why put that inside <a></a> tags if it shouldn't trigger an event? Also, is there a single line written in W3C specs this should work at all?
Updated•22 years ago
|
Updated•22 years ago
|
Comment 8•18 years ago
|
||
*** Bug 197754 has been marked as a duplicate of this bug. ***
Updated•15 years ago
|
Comment 9•13 years ago
|
||
Dell used to employ something like this on their website, was very annoying in Firefox. Thankfully they changed their system, so no worries there anymore...
Comment 10•13 years ago
|
||
This was _not_ fixed in bug 127903. Smaug, I think we should just implement the html5 activation model to handle this....
Updated•13 years ago
|
Comment 12•6 years ago
|
||
Can you please fix this? This is so ridiculous xD 17 years and still not working LOL
Assignee | ||
Updated•5 years ago
|
Updated•2 years ago
|
Comment 13•3 months ago
|
||
I had this same scenario (checkbox in <a> element) on my website and it worked up until Version 119 - it's still not working on Version 121. I was using it in a photo gallery incorporating the jquery ui sortable widget. It still works as intended on other browsers: Chrome, Safari, Brave, so something changed in Firefox. I am currently revising my website code to eliminate the scenario, but it doesn't look good that other browser perform as expected...
Comment 14•3 months ago
|
||
This is a 23 year old bug. Please file a new bug for the specific issue you're seeing as it's almost certainly unrelated to this one if you're seeing a recent behavior change. Bonus points if you can link to a testcase that shows the problem.
Comment 15•3 months ago
|
||
I am also facing the exact same bug in Firefox versions 120.x and 121.x. I can't identify the exact version when it started reproducing but I can confirm that it used to work fine till a few versions back and it's working fine on an older machine running version 115.x. I understand this is a 23 year old bug and the recent change in behavior might be a different issue but the scenario is exactly the same as mentioned in this bug.
I am unable to find a new or recently reported bug that covers this use case. Do I need to file a new bug for this issue?
Comment 16•3 months ago
|
||
See bug 1871424.
Description
•