Ask HN: How do we get Google and Twitter to use href attributes again?

20 points by beaugunderson ↗ HN
I keep finding new places where Google and Twitter use <button> elements or <a> elements with an onclick handler instead of an href attribute; see this example on a search result page:

    https://i.imgur.com/MjyoyJr.png
and this example on Google Maps:

    https://twitter.com/beaugunderson/status/1428011803179507715
and this example on Twitter's trending topics:

    https://twitter.com/beaugunderson/status/1428441375444377601
There are probably many reasons to care about this but mine is that I want to cmd-click more than one result at a time to open them in tabs and I can't do that if they don't have hrefs.

While I don't use a screen reader it seems like a worse experience because of this if one does:

    https://a11y-101.com/design/button-vs-link
    https://naga.co.za/2020/03/13/links-vs-buttons/
It's become a truism that Google only fixes things when they appear on HN and whichever PM is responsible notices them; here's hoping that happens here.

13 comments

[ 2.9 ms ] story [ 37.8 ms ] thread
They have no reason to use href attributes. So they won't.
But do they have a reason to use onclick handlers? Because that seems wildly overcomplicated to me
My guess is that it's a framework issue (whatever Google framework they're using internally makes this the easiest approach) and no one has complained loudly enough for it to reach the person who can change it.
Yeah I guess this is the reason. UI Frameworks may render <Button href=/> as a button with on:click instead of a button-styled link.
They do talk quite a bit about supporting accessibility on the web and in Chrome so they already have an internal reason to use href attributes if there's someone willing to make the case to whoever the decision maker is for Maps.
I don’t use google and Twitter because the pages are fucking unusable even on a modern browser because of stuff like this.

Once you adopt that attitude “making” large corporations behave reasonably stops being something you worry about.

Google is the most widely-viewed website in the world (~87 billion monthly page views) so even if you don't use it, much of the rest of the world does. Not trying to improve things that are widely used isn't an option for me so I'll keep trying, but your point that opting out is an option for some people is taken.

Even if you don't use Google, however, the way they implement things sets a precedent for the rest of the web... and I don't want this practice to spread.

It really is a shame we can't seem to "IE" Google search, e.g. maintain compatibility, but also make sure it's dead in a few years. Oh, well.
Use nitter, a plain Twitter frontend.

Pick a close instance from https://github.com/zedeus/nitter/wiki/Instances

I have installed https://addons.mozilla.org/en-US/firefox/addon/nitter-redire...

I love nitter! That redirect is great, I wasn't aware of that; thanks.

I still want Twitter to fix their trending topics "links" though because if their presumably smart engineers can break things like that then others will follow suit and we'll all suffer as a result. I may be tilting at windmills but I can't help myself.

That's not a bug but a feature - when using href, it would be not possible for them to get data on what link you clicked, and both Google and Twitter rely much on that info.
> when using href, it would be not possible for them to get data on what link you clicked

That's plainly false. You can easily add onclick handlers to a tags, or have them redirect through a tracker, or basically any other thing that would work on a button tag.

This is wrong. Its trivial to track aa link. There is no way you are a web developer with comments like this. Why do you even bother?