-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(switch): fix switch drag functionality. #6715
fix(switch): fix switch drag functionality. #6715
Conversation
f05cee5
to
b8d8cfc
Compare
@@ -150,7 +150,7 @@ function MdCheckboxDirective(inputDirective, $mdAria, $mdConstant, $mdTheming, $ | |||
} | |||
} | |||
function listener(ev) { | |||
if (element[0].hasAttribute('disabled')) { | |||
if (element[0].hasAttribute('disabled') || scope.skipToggle) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@EladBezalel Should I add a comment here to explain what skipToggle
is used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes plz
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
b8d8cfc
to
08ad0b2
Compare
var checkbox = compileAndLink('<md-checkbox ng-model="blue"></md-checkbox>'); | ||
var scope = checkbox.scope(); | ||
|
||
scope.skipToggle = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would this be set to 'true' ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to test if the checkbox skips the click, this is needed for the switch. Bust just rethought, it would make more sense to add this to the switch tests, using the switch extending the checkbox.
This fixes the complete switch drag functionality. Fix ported from my previous work at material2 (https://github.com/angular/material2/pull/7/files) Fixes angular#4719 Fixes angular#2338
08ad0b2
to
1036d6f
Compare
@ThomasBurleson It's very hard for me to detect your reason.. What particular line or block needs work? |
@devversion - your conversation with @EladBezalel indicates unresolved agreement on solution. |
@ThomasBurleson I agree, thx. @EladBezalel Can you respond to my last comment? You didn't answer yet. |
@ThomasBurleson feels odd to me that we need to use |
This fixes the complete switch drag functionality.
Fix ported from my previous work at material2 (https://github.com/angular/material2/pull/7/files)
Fixes #4719 Fixes #2338