←back to thread

Just use a button

(gomakethings.com)
286 points moebrowne | 1 comments | | HN request time: 0.215s | source
Show context
lyricaljoke ◴[] No.45775130[source]
My very similar pet peeve is about websites that use `onclick` handlers and similar to implement navigation. Just use a damn anchor tag, which gets you correct link behavior for free:

* works with middle click for new tab

* integrates with accessibility devices

* works with right click + open in new window or similar options

* etc. etc. etc.

If it's notionally navigation, don't use javascript soup: use a link.

replies(11): >>45775742 #>>45775887 #>>45776191 #>>45776485 #>>45776938 #>>45776972 #>>45777023 #>>45777190 #>>45777640 #>>45779426 #>>45779654 #
Zak ◴[] No.45775742[source]
I've seen an increase in people doing this sort of thing over the past few years. I imagine it has something to do with frameworks and ignorance or apathy, but the old fashioned way almost always provides the best UX.

To anyone reading who has tried to get fancy with a substitute for the <a> tag, I wish you mild discomfort and inconvenience.

replies(3): >>45775993 #>>45778853 #>>45781178 #
philistine ◴[] No.45775993[source]
Could it be that the devs who write that code are not allowed to touch the CSS so they implement the visual functionality they want in their framework instead of telling the design team their intent?
replies(2): >>45776135 #>>45782714 #
1. lewiscollard ◴[] No.45782714[source]
No, it is because a significant subset of React developers do not know how to write HTML.