I tried to follow the widget example by mindtrove's blog. Here is the example demo page.
There are some problems with this widget: left & right arrow keys, and home & end keys are not working in Firefox(I am using a Mac), and none of any keys are working if I load the example page in Safari. I am not sure if this is only my Mac's problem or not working on Mac at all.
Here are some codes in the widget Rating.js:
_onKeyDown: function(event) { switch(event.keyCode) { case dojo.keys.UP_ARROW: case dojo.keys.RIGHT_ARROW: this.currentValue += 1 this.currentValue = Math.min(this.currentValue, this.maximumValue); dojo.stopEvent(event); break; case dojo.keys.DOWN_ARROW: case dojo.keys.LEFT_ARROW: this.currentValue -= 1 this.currentValue = Math.max(this.currentValue, this.minimumValue); dojo.stopEvent(event); break; case dojo.keys.HOME: this.currentValue = this.minimumValue; dojo.stopEvent(event); break; case dojo.keys.END: this.currentValue = this.maximumValue; dojo.stopEvent(event); break; } // refresh the display this._update(); }
As far as I can see, all the keys cought in this function event should work. I am not sure why some are not working. By the way, I find out one thing interesting: for those keys (left, right, home & end) keys in Firefox, they works if I hold my shift key.
I am not sure if the problem is a bug in the widget's codes or Dojo's bug in case of Mac?