Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Is href="#" still necessary?
We use <a href="#">...</a>
in few places for links handled via js. Hovering such a link displays something like current/page/url#
in the browser status bar, which is uselessly distracting and can hide the txp messagepane. Could we simply remove href
from such links, replacing it with cursor: pointer
css rule? IIRC, it bothered IE, but who cares nowadays?
Offline
Re: Is href="#" still necessary?
yes it is needed to make clickable in an accessible way (keyboard access, touch access, AT,…). Or you want to reimplement all that with JS?
<a>test string</a>
is no different than <span>test string</span>
Try here to set focus on that element… (with the keyboard).
On the other hand, perhaps a <button />
would be more appropriate in some cases (e.g, close button on the message pane)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Is href="#" still necessary?
Apparently not (ironically the link there doesn’t seem to jump to the onclick_events section of the page I linked to – about 2/3 of the way down the page)
Not sure how relevant the discussion is, but the ancient stackoverflow page on the topic has alternatives like href="javascript:void(0);"
. But whether that then prevents JS from hooking into the anchor I’m unsure.
Last edited by Bloke (2023-12-11 13:29:09)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Offline
Offline
Re: Is href="#" still necessary?
Certainly not, but wouldn’t tabindex help in this case? Thanks for any hint.
That would, at best, make it eventually focusable. It doesn’t make it “clickable” (mous click, press return from keyboard, tap, etc).
As I said, consider using <button>
, the MDN page Stef links to above suggest the same.
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Is href="#" still necessary?
A button works for me for elements that aren’t actually hyperlinks.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: Is href="#" still necessary?
Buttons work great, but look like buttons :-) Seemingly, jQuery UI can help in my case (body/excerpt preview link), but I’d rather go vanilla way.
Offline
Re: Is href="#" still necessary?
Phil has a CSS class for making buttons not look like buttons somewhere…
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online
Re: Is href="#" still necessary?
Please stay away from JQUI. It is not difficult to style a button: remove border, remove background…
<button class="txp-reduced-ui-button">close</a>
(name TBD, see login panel, language select widget)
Last edited by phiw13 (2023-12-11 14:01:16)
Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern
Offline
Re: Is href="#" still necessary?
Offline
Re: Is href="#" still necessary?
etc wrote #336106:
Nope, can not find it.
Drat. It’s the other way round. We have a class for making a link look like a button (navlink) that I was thinking of. Apologies. Though I’m sure if you ask him nicely he’ll add a class for the inverse ;)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Online