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

fix(slide-toggle): visual hidden input should not bubble click #672

Merged
merged 3 commits into from
Jun 15, 2016

Conversation

devversion
Copy link
Member

@devversion devversion commented Jun 12, 2016

  • Currently the (click) event gets called twice.
    This is caused by the bubbling of the (click) event on the input.

Actually the second click will be called by the label element.
The browsers default behavior is, to trigger a click on the input, once the label got clicked.

This is in my opinion the correct approach, because we don't want to depend on the click event, instead of the change event.

Fixes #671.

* Currently the (click) event gets called twice.
  This is caused by the bubbling of the (click) event on the input.

Fixes angular#671.
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jun 12, 2016
* Moved input click event into component source file.
* Added comment for the issue cause.
@devversion
Copy link
Member Author

@jelbourn Updated the PR (added a comment and moved the event into the component source)

// root container, the click event on the `checkbox` will be executed twice.
// The real click event will bubble up, and the generated click event also tries to bubble up.
// This will lead to multiple click events.
// Preventing bubbling for the second event will solve that issue.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic comment

@jelbourn
Copy link
Member

LGTM

@jelbourn jelbourn merged commit afed818 into angular:master Jun 15, 2016
@devversion devversion deleted the fix/slide-toggle-click-twice branch June 15, 2016 15:39
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(click) event generates twice on md-slide-toggle and md-chekbox
3 participants