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): disabled theme not working and dragging works if disabled #1268

Merged
merged 4 commits into from
Oct 5, 2016

Conversation

devversion
Copy link
Member

@devversion devversion commented Sep 19, 2016

Quick Summary
If checked and disabled theme is now invalid
Dragging while disabled
Improved dragging for UX
  • It seems like as per the new theming feature, view encapsulation turned off and now the checked theming overwrites the disabled theme (too high specificity)
  • If a slide-toggle is disabled, users are still able to drag the thumb (which is invalid)
  • Fix invalid user-select property, and now dragging works without clamps.

Notice: We are two times extra checking for isDragging, that's because we want to keep the renderer as abstract as possible

FYI: I'm trying to get some good HammerJS tests into the slide-toggle in the future.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 19, 2016
// accidentally. Manually prefixing here, because the un-prefixed property is not supported yet.
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't autoprefixer do this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Seems like there is no autoprefixer anymore, and user-select is also kind of a special property for the prefixer (e.g Material 1)

@jelbourn
Copy link
Member

Huh, autoprefixer must have been accidentally omitted from the build change. How is user-select special?

@devversion
Copy link
Member Author

devversion commented Sep 19, 2016

I'm not really sure about it

If I remember correctly, it wasn't get prefixed automatically. That's why I assumed that Material 1.x also does that manually.

Anything I should change / do?

this._slideRenderer.startThumbDrag(this.checked);
if (!this.disabled) {
this._slideRenderer.startThumbDrag(this.checked);
}
Copy link
Member

Choose a reason for hiding this comment

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

Test for this?

Copy link
Member Author

@devversion devversion Sep 23, 2016

Choose a reason for hiding this comment

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

I actually planned to add some gesture tests in another PR (because of big changes), but I will try to add them to this PR soon.

@devversion
Copy link
Member Author

@jelbourn Added the tests for the dragging functionality.

Please notice that I currently use the Gesture Config from the slider package. I would rather move this config to a more generic place in another PR, because this will bloat the Diff.

* It seems like as per the new theming feature, view encapsulation turned off and now the checked theming overwrites the disabled theme (too high specificity)

* If a slide-toggle is disabled, users are still able to drag the thumb (which is invalid)

* Fix invalid `user-select` property, and now dragging works without clamps.
@jelbourn
Copy link
Member

jelbourn commented Oct 5, 2016

LGTM aside from some comment wording

expect(slideThumbContainer.classList).toContain('md-dragging');

gestureConfig.emitEventForElement('slide', slideThumbContainer, {
deltaX: 200 // Use a random number which will be clamped.
Copy link
Member

@jelbourn jelbourn Oct 5, 2016

Choose a reason for hiding this comment

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

// Arbitrary, large delta that will be clamped to the end of the slide-toggle.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, sounds better. Just changed it for all.

@jelbourn jelbourn merged commit 8908366 into angular:master Oct 5, 2016
@devversion devversion deleted the fix/slide-toggle-drag-theme branch November 4, 2016 16:29
@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.

3 participants