tomb — 2012-08-15T07:03:46-04:00 — #1
Wouldn't it be better to simply omit the href attribute, it's not required after all. It seems the only reason to include the href is to force the hand cursor. Since this is possible with CSS is there any semantic or compatibility reason to include the href attribute at all?
Further to that: Should it even be an <a> tag or should I just use a clickable div/li/whatever the parent element is?
I'm interested in the best practice pros/cons of it.
stevie_d — 2012-08-15T07:40:42-04:00 — #2
The main reason for keeping the script activation in an <a> tag is to ensure that it is accessible for keyboard navigation and other assistive technology (including some mobile devices), which usually won't allow anything other than a link or input to receive focus, meaning that if you have the script activation on a <div> or other element, it will be impossible for people without a mouse or certain touch-screen devices to activate it.
I'm not aware of any advantage of including
href="#", although it may be that some devices won't allow keyboard-users to tab to an <a> that doesn't have an href.
markbrown4 — 2012-08-15T08:35:11-04:00 — #3
What Stevie said ^
I'd only add that having a proper URL in the href to that content also helps people like me who like to right click > open in new tab. It does depend on what you are showing on click though.
felgall — 2012-08-15T16:45:34-04:00 — #4