Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
ghost opened this issue Feb 5, 2012 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 5, 2012

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 ghost self-assigned this Feb 5, 2012
@ghost
Copy link
Author

ghost commented Feb 5, 2012

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

ghost pushed a commit that referenced this issue Feb 6, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants