...

View Full Version : a onfocus element.blur behavior



Shecky
03-11-2003, 05:56 PM
i'm sure its been thought of before and i'm sure this is just gunna piss off the people who like to tab through their pages, but i just made a little behavior component file that stops any links from gaining focus on your page.

put this is the style section of your page.



<style type="text/css">
a { behavior: url("hidefocus.htc"); }
</style>


then put the attached file in the same dir. (hidefocus.htc) this is all it is




<public:component>
<public:attach event="onfocus" handler="blurry" />

<script>
function blurry() {
element.blur();
}

</script>
</public:component>



Note: since this behavior is stored in an external file, sometimes one instance of link focus can occur before the htc file can be loaded. if anyone has any tips on fixing that i'd like to hear'em.

brothercake
03-11-2003, 06:33 PM
Originally posted by Shecky
if anyone has any tips on fixing that i'd like to hear'em.

:mad:

My tip would be don't use it at all. If you want to hide the focus-border you must only ever do it with click or mousedown/up events; never with focus.

Sorry - my anger is not directed at you or anyone specifically - but I get annoyed by this kind of anti-accessibility scripting; it's the exact opposite of the kind of coding practise I'm trying to encourage. This would be infinitely better:

<public:attach event="onmousedown" handler="blurry" />
<public:attach event="onmouseup" handler="blurry" />

Unplug your mouse. Try working without it. Then you'll see.

Shecky
03-11-2003, 07:25 PM
WOAH... :eek:

:( oh brothercake, how many coding jams have you helped me out of? ...and now this... THIS!!! Are you from a country where mice are considered sacred and you can't touch them?

I'm not sure about you anti-mouse people... it was created for a reason you know. The mouse wheel, especially! For what reason do you feel the tab button is more functional than a wheel and a pointer? :confused:

Everyone and their mother tabs through forms, this type of thing which requires one to type... i'm sorry if you're one of the few who has to tab through EVERY page, and who winces when your fingers have to leave the home row :p

To be fair i also didnt take into consideration anyone who uses a browser other than IE, so there ya go. Broad based discrimination. (That probably didnt help my case.) ;)

I don't believe i'll be unplugging my mouse unless i feel like roughing it for a few days.. eh, or... maybe... it is lent and all. Now if someone starts messing with my onmousewheel function, then theres hell!!!!!!!!!! :mad:

btw, onmousedown and onmouseup are too slow from a timing standpoint to totally eliminate the ugly outline. so nah. This is meant for a person who USES onfocus="blur(this)" and doesnt like to type it out for every single link. There are a lot of us, sorry...

and now that i've started some sort of onholy focus war, i shall run off and hide until brothercake and his clan come back and give me what for.

(press [TAB] nine times to go to the submit reply button, please.) :D

brothercake
03-11-2003, 07:52 PM
Originally posted by Shecky
For what reason do you feel the tab button is more functional than a wheel and a pointer? :confused:

How about - for people who can't use a mouse ...

My suggestion you unplug your mouse is so you can empathise with those people; understand how they navigate websites so you can allow for this in your coding practise.

Don't get stressed though - I'm not having a go at you. But this is important - hence the strength of my response :)

Shecky
03-11-2003, 08:10 PM
Originally posted by brothercake
How about - for people who can't use a mouse ...

My suggestion you unplug your mouse is so you can empathise with those people; understand how they navigate websites so you can allow for this in your coding practise.

Don't get stressed though - I'm not having a go at you. But this is important - hence the strength of my response :)

If you're going to place special consideration on these people, you may as well code all of your web pages with.. i dunno... netscape 2 in mind.

Theres that old saying, you cant please everybody all of the time. To the people who can't use a mouse but for some reason can use a keyboard, i'm very sorry... but only in a symbolic sense.

Short of stephen hawking coming to my door and having his goons beat it out of me, i think i'm gunna stick with eliminating focus on links.

brothercake
03-11-2003, 08:58 PM
Originally posted by Shecky
If you're going to place special consideration on these people, you may as well code all of your web pages with.. i dunno... netscape 2 in mind.

Exactly :) :thumbsup:

Accessibility in no way implies a reduction in functionality; it's all about how you apply that functionality so that it degrades gracefully.

Netscape 2 is an excellent test browser; with an XHTML+CSS paradigm there's no reason why you can't make the eye-candy all-singing all-dancing site you want, that is *still* basically coherent, legible, navigable and useable in the most basic of web browsers, all the way back to Lynx.

Sure it won't look the same, but it doesn't have to; equivalency does not mean equality.


Originally posted by Shecky
i'm very sorry... but only in a symbolic sense.

I'm not sure what you mean by this. You don't have to make your site accessible if you don't want to. What I don't understand is why you wouldn't want to; why not make the best possible website you can? Because you don't like dotted lines ..?

Is your website just for you? If it is, then fair enough; forget everything I've said. If not ... well ... accessibility is not just about disabled people; it's about everyone.

I could ramble on forever ...

Shecky
03-11-2003, 10:00 PM
Shecky has issued this official response:

[statement] (http://www.technosquid.com/externaljunk/mylinksarepretty.gif)
to which he would like to add "so bleh on you" and "you smell"

jkd
03-11-2003, 10:12 PM
Just skimming through this thread, there are two distinct things at work:

1. You don't like dotted lines
2. You disable focusing

Taking care of #1 does not require performing #2.

Just because focusing causes "ugly" (your opinion) dotted lines doesn't mean you should disable focusing. Rather, why not change the focus indication?

a:focus {
outline: black solid 1px;
}

For a solid outline instead of a dotted one. Use -moz-outline in addition if you want it to work in Moz, as well as Opera and Konqueror.

Shecky
03-11-2003, 10:59 PM
Originally posted by jkd

Just because focusing causes "ugly" (your opinion) dotted lines doesn't mean you should disable focusing. Rather, why not change the focus indication?

a:focus {
outline: black solid 1px;
}

For a solid outline instead of a dotted one. Use -moz-outline in addition if you want it to work in Moz, as well as Opera and Konqueror.

If someones goal was to not, themselves, see any dotted lines on web pages that they made, then they should take that advice.

I want other people not to see the focus... in my own personal form of focus nazism, or something. Focus is the cause of all of our problems, and it must be eliminated!!!!

As shocked as i am that some browsers now support that outline css style, i dont think i'll be using it for the benefit of only mozilla, opera, and konqueror users.

I'll just make a version that hides the outline, but changes the color when focused :) that'll please everyone. Unless cake boy finds a problem with that too!

WA
03-11-2003, 11:20 PM
Ok guys, I know this is mostly in fun, but lets lay off the whimsical sarcasm, as it could easily be misunderstood eventually. This thread will remain open as long as any further discussion gets back on "track."

Borgtex
03-12-2003, 02:14 AM
my two cents: no dotted lines, no focusing disabled, one single instruction

document.onclick = self.focus;

brothercake, as I agree with you concerning to accessibility, I think that your anger is a bit disproportionate; remember: Flash is the real enemy ;)

Shecky
03-12-2003, 03:14 AM
Originally posted by Borgtex
my two cents: no dotted lines, no focusing disabled, one single instruction

document.onclick = self.focus;

brothercake, as I agree with you concerning to accessibility, I think that your anger is a bit disproportionate; remember: Flash is the real enemy ;)

Well it is awfully simple... if only it fit in with my blurred reich. I even redundantly added the stoptab feature, for extra spite.

Man i hope brothercake will still help me with my coding questions after this. ::waves at BC:: dont be maaaad!

brothercake
03-12-2003, 10:51 AM
Originally posted by Shecky
::waves and BC:: dont be maaaad!

Course not :) It's all cool; we're just having a discussion ;)

beetle
03-12-2003, 07:48 PM
Well, since using a DHTML behaviors is only for IE 5.5+, you might as well use another IE 5.5+ only thingie (http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/hidefocus.asp)

Shecky
03-12-2003, 09:55 PM
yea i couldnt get hidefocus to work with it ::shrugs::

you'll have to show me up and figure it out for my stupid ***.

mattover-matter
04-12-2003, 03:48 AM
onload = function() {
a_tags=document.getElementsByTagName('a')
for (i=0;i<a_tags.length;i++) {
a_tags[i].onfocus=blur_links
}
}

function blur_links() {
this.blur()
}

will get rid of em all :D

Borgtex
04-14-2003, 06:18 PM
btw, seems that my solution (document.onclick = self.focus) crashes IE6, don't know why.
So now I use document.onclick = new Function ("self.focus()");



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum