-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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] Update style to match the specification #22782
Conversation
@@ -634,7 +634,7 @@ const SliderUnstyled = React.forwardRef(function SliderUnstyled(props, ref) { | |||
<input value={values.join(',')} name={name} type="hidden" /> | |||
{marks.map((mark, index) => { | |||
const percent = valueToPercent(mark.value, min, max); | |||
const style = axisProps[axis].offset(percent); | |||
const style = axisProps[axis].offset(clamp(percent, 0.5, 99)); |
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.
prevents marks being displayed outside the track
@@ -198,14 +192,20 @@ const SliderRoot = muiStyled( | |||
}, | |||
'& .MuiSlider-valueLabel': { | |||
// IE 11 centering bug, to remove from the customization demos once no longer supported |
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.
We should still re-visit the centring styling once we drop IE 11
@material-ui/lab: parsed: +0.22% , gzip: +0.18% |
2891e99
to
ffd57d6
Compare
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.
We're missing a box-shadow on the thumb.
On a related note, I recall a discussion with @mbrookes about the classes API: "Slider track and rail means the same thing". My imagination fails to find something better.
@@ -39,8 +40,9 @@ function ValueLabel(props) { | |||
className: clsx(children.props.className), | |||
}, | |||
<Root className={clsx(classes.offset, className)} theme={theme}> | |||
<span className={classes.circle}> | |||
<span className={classes.container}> |
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.
It seems like we removed and added classes but I see no documentation changed. Is this not something that is auto-generated or available in types?
/cc @mnajdova
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.
These classes are not the props classes:
const classes = useValueLabelClasses(props);
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.
So there are no classnames that can target the ValueLabel
component?
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.
I have noticed the following issues:
- Inversed color issue
It's the 3rd regression from moving from the withStyles to styled API (emotion, not MD spec update related). I think that we didn't catch it in Argos because we introduced a new component, we didn't replace the existing one.
- No more box shadow when dragging
- Vertical alignment issue, especially noticeable on a touch device
On a related note, I wonder about the dense mode. What are your thoughts on providing a dense variant of the slider? The new design looks great on mobile. But on desktop? 20px, that's bold for the thumb! When Ant design is 14px, the previous spec was 12px, native slider on Chrome is 16px.
c074eec
to
2c4ba3e
Compare
https://github.com/mui-org/material-ui-pickers/issues/2136#issuecomment-706066008 Could we apply the same logic here? I'm not convinced that all of the changes to the slider in the current spec are an improvement. |
@mbrookes Google has started to use the new design. Happy to wait for Android 12 too. Is this statement accurate? In the early days, Material Design guidelines were release after they deployed the design. It seems to be increasing going in the other direction. I'm personally more in favor of implementing the design spec after it gains mass adoption in Google's product. This has the following advantages:
On a related note, this makes me think of a discussion with the Material Design team. I recall they tried to create a distinction between "Google Material Design theme" and the "default Material Design theme". They encouraged us to follow the "default Material Design theme", but shouldn't we aim for "Google Material Design theme"? |
This comment has been minimized.
This comment has been minimized.
The poll on Twitter seems to suggest that we can move forward. However, I would raise the need for a dense mode. I think that it's important for work tools. For instance, I was just checking a design tool's slider. |
I'm closing as the effort has been stale for some time, thanks for the exploration. |
Closes #20153
Breaking Change
circle
changed tocontainer