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

[Slider] Fix thumb outline not matching spec #12967

Merged
merged 13 commits into from
Oct 3, 2018

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Sep 22, 2018

The material design specification defines a boxShadow for hover, pressed and focused which was currently only partially applied from the implementation.

WIth this PR the implementation should match the specification considering the thumb outline.

Visual comparison:

Also fixes track outspacing thumb when using arrow keys while slider
is focused.
The thumb never resizes on any interaction in the new design spec.
Only the outline changes.
@mbrookes
Copy link
Member

mbrookes commented Sep 22, 2018

Looks good. While testing, I noticed what appears to be (another) bug - pressing space resets the slider to zero. Not one for this PR, just thought I'd mention it while you're on a Slider cleanup crusade. 😄

@eps1lon
Copy link
Member Author

eps1lon commented Sep 23, 2018

Argos fails are expected since I had to increase to root padding so that the outline of the thumb does not overflow the slider container.

@oliviertassinari oliviertassinari added the component: slider This is the name of the generic UI component, not the React module! label Sep 23, 2018
@mbrookes
Copy link
Member

mbrookes commented Sep 23, 2018

I had to increase to root padding so that the outline of the thumb does not overflow the slider container.

I'm not sure that's the right trade-off. Looking at the spec, it seems the shadow, and possibly also the thumb should be allowed to overflow the container:

image

https://material.io/design/components/sliders.html#theming

@eps1lon
Copy link
Member Author

eps1lon commented Sep 23, 2018

@mbrookes I created a quick example to compare the crane theme with this implementation. This implementation has a little bit more horizontal space close to theme.spacing but way less vertical. It's hard to tell if it's the slider bbox or outside margins that create the space but I think it's the responsibility of the slider to not overflow into it's surroundings.

This has also practical implications since it increases the area for mouse interactions which was already improved in #11889 and also addressed possible overflow issues.

@mbrookes
Copy link
Member

@eps1lon What I was looking at in that screenshot is the alignment of the ends of the slider track with the left edge of the label, and the right edge of the checkbox.

If that is the outer margin, then the thumb and shadow would overflow. If it isn't then we need to demonstrate how to reconcile the alignment of the slider with other components.

@eps1lon
Copy link
Member Author

eps1lon commented Sep 24, 2018

@mbrookes Ah yes now I get it. I scanned some of the other components and it seems that they never define margins/paddings themself and leave it to the user to align them.

I think we should therefore remove the padding completely which makes it straightforward to align components.

@eps1lon
Copy link
Member Author

eps1lon commented Oct 1, 2018

@mbrookes Removed padding so that users are in full control of the alignment.

@mbrookes
Copy link
Member

mbrookes commented Oct 1, 2018

Okay, I'm good with this, it feels like the right compromise. Not sure what's up with CI though.

@eps1lon eps1lon merged commit 1c19bdf into mui:master Oct 3, 2018
@eps1lon eps1lon deleted the feat-slider-outline branch October 3, 2018 11:57
eps1lon added a commit to eps1lon/material-ui that referenced this pull request Oct 3, 2018
Document how to apply mui#11889 which was removed from default
implementation in mui#12967.
eps1lon added a commit that referenced this pull request Oct 4, 2018
* [Slider] Lowest value for vertical should be at the bottom

* [Slider] Fix lagging transition on vertical slider

* [Slider] Fix thumb position on horizontal sliders

* [docs] Document how to improve actionable area

Document how to apply #11889 which was removed from default
implementation in #12967.
@eps1lon eps1lon mentioned this pull request Oct 30, 2018
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: slider This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants