Closed Bug 1526035 Opened 6 years ago Closed 6 years ago

Placing a link with a click handler inside a button

Categories

(Core :: DOM: Events, defect)

64 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1089326

People

(Reporter: fabiosantosart, Unassigned)

References

()

Details

(Keywords: parity-chrome, parity-edge, testcase)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:64.0) Gecko/20100101 Firefox/64.0

Steps to reproduce:

Placed a link with an onclick handler inside a button like so:

https://jsbin.com/qufupoc/edit?html,output

Actual results:

When I clicked the link, I didn't see the alert.

Expected results:

The onclick handler should have run and I should have seen the alert.

The importance of this issue is a bit greater given a lot of developers are getting their React components from npm. In React you don't know what kind of tag you're putting on the page without looking at the component's source code, and most people don't go see their npm package sources (I know I don't) and if they did, they probably won't know that placing a link inside a button is invalid HTML.

The issue is that, since chrome and edge supports it, and now essentially they hold the entire market share, and developers already don't test their stuff on all browsers, they end up shipping a buggy HTML.

Since firefox already supports click events when it's the button that's inside the link, then why not the other way around?

It would be appreciated if in the future you could test the latest Nightly in a brand new profile before filing a report.
https://developer.mozilla.org/docs/Mozilla/QA/Bug_writing_guidelines

mozregression-gui couldn't get a narrow pushlog, but I'm reasonably sure bug 1089326 is what fixed it.
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=d235fd42709b8a7e972a59b7e9d52bd7424a994d&tochange=b0ea65047a1ac530b18cbbf39ae2f8e6ac3b5866

Status: UNCONFIRMED → RESOLVED
Closed: 6 years ago
Component: Untriaged → DOM: Events
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.