Here is a Checkbox.js patch which implements radio button left/right arrow navigation. It uses Wild Bill's nifty modulo suggestion (thanks Bill).
It skips over any disabled radio buttons to the next available radio button in the group and wraps around if necessary. It is a finite loop.
When I find an appropriate candidate radio button I call radio.domNode.focus(). Does that seem correct? (Note: I need to set focus to the target radio button so that the next key event goes to the correct radio button). I also call radio._onClick(null) to (ultimately) set the value true. I suppose I could just call this.setValue(true) directly (perhaps with a check to make sure it isn't already checked like the _onClick handler does).
Regarding style... I've used some shortish local variable names to try and keep the source small. I get the idea from the style guide that permissible name terseness varies directly with scope... which makes some sense to me. I'd like feedback on this too if possible... well actually any and all feedback is appreciated.
Subscribe to:
Post Comments (Atom)
1 comment:
To be clear... as scope increases, terseness should decrease.
Post a Comment