Re:A contribution to the wild-bug-hunt-story genre
by whbrown on Friday August 09, 2024 @07:26PM
(#41206239)
Why make it a link if you aren't linking to anything?
[ Parent
| on HN ]
Re:A contribution to the wild-bug-hunt-story genre
by andrewfromx on Friday August 09, 2024 @08:48PM
(#41206562)
so you don't have to set "cursor: pointer" in css
Re:A contribution to the wild-bug-hunt-story genre
by dzaima on Friday August 09, 2024 @09:04PM
(#41206634)
And it gives some baseline accessibility functionality. Sucks that there isn't any gerneral "I am clickable" element that neither has bad default click behavior, nor has its own likely-unfitting styling.
Re:A contribution to the wild-bug-hunt-story genre
by danparsonson on Saturday August 10, 2024 @02:00AM
(#41207642)
What's wrong with a button? You can make it look like an <a> can't you?
Re:A contribution to the wild-bug-hunt-story genre
by dzaima on Saturday August 10, 2024 @06:13AM
(#41208486)
https://stackoverflow.com/questions/1367409 has varying amounts of CSS for that, ranging from bad (i.e. more than one line, i.e. the bar to beat for people to automatically use it over <a>) to horrific.
Looks like the rough minimum is this:
background: none;
border: none;
padding: 0;
cursor: pointer;
font: inherit;
And, given that some answers there have browser-specific additions, it looks like the spec doesn't have sane effective restrictions on what funky things browsers can do, thus essentially making the answer a "no, you cannot portably make a button look exactly like a link".And no CSS I could find made the button content flow inline with surrounding text (I even went through all of the computed CSS in FF devtools and added the differing ones to the button), so it looks like the answer is "no" in practice too. (though, granted, for a good amount of link-buttons out there you'd probably want no mid-button breaking)
Certainly looks like it'd be simpler to make a <span> act like a link, than a <button>, at least. At which point you lose the implicit accessibility functionality.
Re:A contribution to the wild-bug-hunt-story genre
by KTibow on Saturday August 10, 2024 @12:22AM
(#41207303)
You should really use a button for this. Using anything else is semantically incorrect, and the "it comes with bad styles" argument doesn't make sense given a CSS reset is under 10 lines of code, or even less if you use the `all` style.
Re:A contribution to the wild-bug-hunt-story genre
by williamdclt on Saturday August 10, 2024 @09:39AM
(#41209414)
why avoid so hard to make it a `submit` for a `<form method="POST" action="/logout">`, which is semantically correct and removes all the need for any javascript (logouts have never needed JS after all)?
Re:A contribution to the wild-bug-hunt-story genre
by andrewfromx on Saturday August 10, 2024 @11:46AM
(#41210272)
because you often need to send a DELETE verb not POST