Support linking / hrefs on any element


The way I was envisaging it, it should help with the tr use-case. E.g.

<tr link-container>
    <a href="">Google</a>

In this case, the browser would find the first anchor descendant of the tr, which is the Google link, and expand its clickable area to the whole row.

But yes, maybe this would be better as a CSS feature. Something like

tr.nav {
  link-behaviour: first-anchor;

And I’ve already seen this thread linked elsewhere as a discussion about adding href to arbitrary elements, so trying to rewrite history is probably a bad idea.


I see. Unfortunately, accounting just for the first link in the row could lead to ambiguity when other cells in the row contain links (potentially pointing to different URLs) too.


some issues:

  • User presented with mulitple redundant ‘links’ with different accessible names (which mayor may not provide a useful description of the link target, “foo” “bar” all pointing to same target.
  • involves adding additional (redundant) UI elements for AT users to navigate.
  • the mechanishm for turning <tr href="/products/42/"> into <td><a href="/products/42/">Foo</a></td> <td><a href="/products/42/">Bar</a></td> is neither trivial or currently available.


agree it would be helpful if implementers commented here, would reduce the amount of wishful, but impractical discussion.


True, but that ambiguity seems unavoidable regardless of the solution, because you always have the possibility of one link being a child of another. Even if you allowed linking on the directly on the tr element, people could still put anchors inside it.

I would suggest the behaviour should apply if, and only if, there was only a single visible anchor descendant. If you included more than one anchor, the property would be ignored and the browser behaviour the same as it is now.

Another benefit of making it a CSS property would be that you could use media queries to turn it off and on. This kind of linking is especially common, and useful, on mobile, where regular hyperlinks can be difficult to click on, especially if they’re data-bound and potentially small (e.g. a table of titles or usernames, which could be “a”, “b”, etc.).


As noted earlier


Opera used to implement almost exactly this, before their engine switched to Chromium:

Digging up its history may be helpful here.

EDIT: found some more context and competing proposals here:

EDIT AGAIN: found Opera’s original spec