r/programming • u/blondin • Apr 22 '10
no reddit, noes! on your slow-loading websites (not reddit.com :) ) don't use javascript to focus the first input box. because by the time the page has loaded i have already inserted my username and am entering my password >:(
53
Upvotes
31
u/[deleted] Apr 22 '10
This title makes me want to vomit.
24
u/[deleted] Apr 22 '10
Its not just web-pages/javascript - everyone seems to do this now, launch a program in the background and POP its window forces itself to the front whenever it decides its time for you to deal with it.
Thats my number 1 gripe with programmers today, no one respects that one simple rule. NEVER steal control from the user.
Not even Apple gets this anymore - that was one of my biggest gripes about Windows, the Mac OS strictly discouraged automatic focusing, their developer guides even stressed the importance of not doing it.
But since OSX they do it all the time now just like everyone else. Its a stupid practice, designed to make things simpler for stupid people, but just annoys the hell out of everyone else.
7
u/[deleted] Apr 22 '10
or, detect if the value of the input box differs from the default, and only focus if not. Pretty simple:
off the top of my head:
there are better ways, too.
17
u/[deleted] Apr 22 '10
HTML5
autofocuscouldn't come sooner for you. The moment the textbox appears it'll be focused.6
u/smellycoat Apr 22 '10
How's about a bit of inline script to do it. You shouldn't need to wait on DOMReady to do this:
4
u/jpknoll Apr 22 '10
I fell like reddit needs a new "If you do X, I hate you" subreddit.
3
u/gentleretard Apr 22 '10
The real problem is attaching the focus logic to body.onload event. Place the script tag right after the input tag... problem solved.
2
u/phedre Apr 22 '10
Know what I hate? Sites that automatically skip my cursor to the next text input box.
Check www.aeroplan.com and start entering numbers into the login box. Not only do they stupidly break up a 9 number ID into three separate boxes, they also skip your cursor to the next box as soon as you finish typing the third character.
What if I make a typo? It's a pain in the ass to skip back and edit the numbers. Quite often it'll just skip my cursor forward again.
STOP DOING IT. ARGH. I can tab to the next field on my own!
1
u/[deleted] Apr 22 '10
Worst thing in the world is the auto-selecting of text upon focus that some asshole developers do. You never know when its going to strike. It always ends up taking more clicks than it should. It creates more "work" for users. Just a horrible idea.
1
u/orangesunshine Apr 22 '10
The issue is because yslow and google page speed have recommended (usually incorrectly) putting the JS at the bottom of the page... firing off events after all the images and such are done loading.
1
u/[deleted] Apr 22 '10
Or have a focus observer on all other inputs that disables the onload focus. (There is always a solution that adds MORE complexity!)
1
u/Aepic-27 May 27 '22
Bully
1
u/meor Apr 22 '10
It's the style of typing that makes me want to punch babies.
-1
u/br1 Apr 22 '10
Where's the fffffffuuuuuuuuuuuu?