aFarkas / jMediaelement

jquery multimedia framework
GNU General Public License v2.0
150 stars 23 forks source link

Change event called twice when using spacebar to toggle play/pause checkbox control state #18

Open ghost opened 12 years ago

ghost commented 12 years ago

When using a checkbox control for the play/pause toggle, the change event is fired twice when using the keyboard (spacebar) to check or uncheck the play/pause checkbox control. This issue applies to the JME 2 + jQuery Mobile branch. I'm currently investigating this issue.

Alexander, if you have any insights, let me know.

Cheers, Matt

ghost commented 12 years ago

Just a little update on this issue. Looks like jQuery Mobile sets the checked attribute when the keyboard is used, thus triggering another change event. The following is the relavent code snippet from jquery.mobile.forms.checkboxradio.js:

                vclick: function() {
                    var $this = $(this);

                    // Adds checked attribute to checked input when keyboard is used
                    if ( $this.is( ":checked" ) ) {

                        $this.attr( "checked", "checked" );
                        self._getInputSet().not($this).removeAttr( "checked" );
                    } else {

                        $this.removeAttr( "checked" );
                    }

                    self._updateAll();
                },

Cheers, Matt