A peculiar web-coding conundrum

A peculiar web-coding conundrum

Re: A peculiar web-coding conundrum Posted by Gollum on Wed Nov 16th 2005 at 1:08pm
Gollum
1268 posts
Posted 2005-11-16 1:08pm
Gollum
member
1268 posts 525 snarkmarks Registered: Oct 26th 2001 Occupation: Student Location: Oxford, England
Whilst designing a web site, I came across this bizarre puzzle. I've created a minimal test case that
demonstrates the bug in as simple a framework as possible. There are four short test pages:

http://www.snarkpit.net/pits/gollum/javascript-test/test1/test1.html

The bug appears in Firefox, but not in IE.

See what you think. The input of web developers and coders would be especially helpful (Crono?).

It seems that I need some way to take the focus away from a link, after the link is clicked. Any ideas?
Re: A peculiar web-coding conundrum Posted by Gollum on Wed Nov 16th 2005 at 2:57pm
Gollum
1268 posts
Posted 2005-11-16 2:57pm
Gollum
member
1268 posts 525 snarkmarks Registered: Oct 26th 2001 Occupation: Student Location: Oxford, England
Hmmm, I seem to have solved my own puzzle. I can move the focus
away from the link and to some other element with this script:

document.getElementById('some other element').focus()

Other comments and ideas still welcome though :smile: Sorry if I wasted anyone's time.
Re: A peculiar web-coding conundrum Posted by Crono on Wed Nov 16th 2005 at 6:40pm
Crono
6628 posts
Posted 2005-11-16 6:40pm
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
Focus is very useful.

I usually use it for popups. (well, mixed with the parent definition)

I didn't see what the original problem was. Or what you were going for.
Blame it on Microsoft, God does.
Re: A peculiar web-coding conundrum Posted by Gollum on Wed Nov 16th 2005 at 9:33pm
Gollum
1268 posts
Posted 2005-11-16 9:33pm
Gollum
member
1268 posts 525 snarkmarks Registered: Oct 26th 2001 Occupation: Student Location: Oxford, England
Focus is very useful.

I usually use it for popups. (well, mixed with the parent definition)

I didn't see what the original problem was. Or what you were going for.
I've never explicitly used focus in web pages before, so at first it didn't occur to me.

The original problem (see test 3 on that link) was this: when you click
a link, Firefox won't scroll the page (with arrow keys, page Down/Up,
or mousewheel) until you refocus the document by clicking somewhere
else. It would be very confusing to many people, who might think
the page was broken.

I was going for the ability to hide parts of a page by clicking on a link within that part. So when you click the link, it disappears.

It might not seem very useful, but it would be great for showing/hiding
navbars, or even showing a fullscreen view (which is what I have in
mind).
Re: A peculiar web-coding conundrum Posted by Crono on Thu Nov 17th 2005 at 12:04am
Crono
6628 posts
Posted 2005-11-17 12:04am
Crono
super admin
6628 posts 700 snarkmarks Registered: Dec 19th 2003 Location: Oregon, USA
Oh.

Yeah, IE let's the scroll bars act where the mouse sits ... I think. Not sure, I haven't actually loaded IE in a long time.

Cool.
Blame it on Microsoft, God does.