views:

27

answers:

3

There is a common practice of using <a></a> tags to markup beautiful buttons, with onlick and onhover style change, etc. Which looks and behaves great, on most part.

Although there turned out to be a HUGE problem, which was not very obvious on start. The problem is that these beautiful "buttons" open new windows on middle click, either blank or with the same content as current one (depends on whether one uses # or javascript:; to disable href part).

Now I've got JavaScript RIA with buttons all over it, opening new windows on middle click... Lame...

At first I even couldn't understand why I get sometimes those blank pages in the browser.

Since it's pretty established practice to use links in such manner, maybe there is any established way to deal with described problem?

A: 

Assign a function to the link, which returns false. For example:

<a href="javascript: return false">Not clickable</a>
elcuco
I tried but it doesn't help. Does it work for you?
jayarjo
A: 

Don't have href="javascript:…" in the first place, build on things that work.

David Dorward
I agree, but that's not a case with RIA, which should not go anywhere and just stay where it is and work without reload.
jayarjo
Ah, "Rich" is code for "cutting corners and then suffering from blank pages when people interact with it as if it was a web app" is it?
David Dorward
:D yeah, kinda. But it was not meant to create blank pages :)
jayarjo
A: 

What I did in the end, was that I replaced all <a>...</a> tags with <span>...</span>s. The only problem with this is that IE doesn't support :active on spans, so I do not really get interactive buttons anymore in IE.

jayarjo
... and people can't focus on the links using a keyboard, a TV remote control or a breath switch or access the "links" by using the "read me all the links in this document" features of most screen readers. This is a horrible, inaccessible hack to work around side effects of an ugly corner cutting technique.
David Dorward
Well, they were not exactly meant to be links at all. I guess you never understood the problem really.
jayarjo
If we say "Control the user has to interact with" instead of "Link" then the same problems apply.
David Dorward
I think at some point I will replace them with styled buttons and the odyssey will end there.
jayarjo