Slider Handling Enter/Return Key

Slider Handling Enter/Return Key


I am using the slider for a simple form, and realized that when the
slider has the focus, and I press enter, it actually moves the handle
to the start (basically, it seems it is interpreting the enter as a
click, and without the mouse coordinates, it just moves the handle to
the start).
Anyway, what I really wanted to be able to do is make it submit the
form (as occurs with other form fields that may have the focus). I
have not figured out how to achieve this using the slider as is. If
somebody knows a way, please let me know.
What I have done is changed the keydown handler as follows:
                .bind('keydown', function(e) {
                    if(/(37|39)/.test(e.keyCode))
                        self.moveTo((e.keyCode == 37 ? '-' : '+')+'='+
(self.options.stepping ? self.options.stepping :
(self.options.realMaxValue / self.size)*5),this.firstChild);
/* NEW CODE */
                    else if (self.options.enter && /13/.test(e.keyCode))
                        self.propagate('enter', null);
                        return false;
/* END NEW CODE */
                })
This allows the 'enter' option to be used for a callback whenever the
enter key is pressed. This seems to work OK. Would this change be
regarded as a useful modification? Or is there a better way?
Jeremy