[Rails-spinoffs] javascript woes with radio button groups

Tom Gregory tomg at byu.net
Sat Jul 1 18:11:38 GMT 2006


Two comments:

1. If you're navigating immediately on click, you're already not  
really accessible to those with possible motor difficulties.   
(Accessibility doesn't just mean visual impairments and text browsers!)

2. The functionality you're describing isn't really that of a radio  
button... it's of a button that *looks* like a radio button.  why not  
just use the <button> tag, imbed an image of a radio button, and  
style the whole thing to look like a regular radio button.  Allows  
keyboard navigation!

TAG

On Jun 30, 2006, at 3:55 PM, Jeremy Kitchen wrote:

> Ok!  So I have this survey project I'm working on where there are a  
> list of
> questions but only one shows up at a time.
>
> That part's easy.  And, it is fully functional as we speak (and I  
> think even
> 'live')  however.....
>
> My boss wants to be able to have the survey go to the next question  
> when a
> user selects an answer.  This part is easy.. except.....
>
> IE doesn't fire the onChange event until the radio button group has  
> lost
> focus.  So if you just rely on the onChange event, the user has to  
> make 2
> clicks (in firefox, the onchange fires when you change the which  
> option is
> selected)
>
> so, I thought.. I'll just make it so when the option is focused, I  
> immediately
> blur it so IE fires the onchange event.  This works!   
> Unfortunately, it
> breaks keyboard access to the form.  Troublesome.
>
> So, I thought.. how about just making it so it fires onclick!   
> Well, the
> problem with that is that in both IE and Firefox, when you use the  
> keyboard
> to change which option is selected, it fires the onclick event!  So  
> far, I
> haven't been able to differentiate this particular event between a  
> 'real'
> click and a keyboard-initiated onclick event (in either browser).
>
> I've sorta given up, and my boss went with the 'easy clicking for  
> mouse users'
> option and said 'screw accessibility', and I pretty much agree with  
> him.. but
> there's gotta be some way to do this :)
>
> So here's my question... anyone know how?  What events should I  
> listen for?
> What do I need to check in those events to tell if I'm being  
> triggered by
> someone actually clicking with their mouse, or using the keyboard  
> to select
> the answer.
>
> When all is said and done, I'm going to post a howto about this up  
> on the web,
> as I'm sure stuff like this comes up from time to time... if  
> nothing else I
> think it might be useful to someone.. hehe
>
> Thanks!
>
> -Jeremy
> _______________________________________________
> Rails-spinoffs mailing list
> Rails-spinoffs at lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs



More information about the Rails-spinoffs mailing list