Skip to content

[Slider] Fix Slider div style#4087

Merged
mbrookes merged 1 commit intomui:masterfrom
tintin1343:slider-div-style
May 2, 2016
Merged

[Slider] Fix Slider div style#4087
mbrookes merged 1 commit intomui:masterfrom
tintin1343:slider-div-style

Conversation

@tintin1343
Copy link
Copy Markdown
Contributor

  • PR has tests / docs demo, and is linted.
  • Commit and PR titles begin with [ComponentName], and are in imperative form: "[Component] Fix leaky abstraction".
  • Description explains the issue / use-case resolved, and auto-closes the related issue(s) (http://tr.im/vFqem).

Resolves: #3282

The issue with the current slider style was that it used to apply styles twice because of the prepareStyles including style and hence the width % was being applied twice.

I removed the style parameter in object.assign as that was the reason of including the styles twice.
So the style will be applied only once to the Slider div. Renamed styles.root to style.slider

@oliviertassinari
Copy link
Copy Markdown
Member

oliviertassinari commented Apr 28, 2016

This PR is introducing a breaking change. Do we want to wait for v0.16?
Or we could consider that the behavior was already broken end it's not a breaking change.

@tintin1343
Copy link
Copy Markdown
Contributor Author

I don't mind anything here. I would like @nathanmarks and @mbrookes to comment.

@mbrookes
Copy link
Copy Markdown
Member

mbrookes commented Apr 28, 2016

@oliviertassinari - I agree with you that this is a bug, but potentially a breaking change to remove style from slider. How useful might it be to be able to style the slider at this level rather than the root div? (i.e. how likely is it someone is depending on the style prop being removed here?)

Comment thread src/Slider/Slider.js Outdated
const {prepareStyles} = this.context.muiTheme;
const styles = getStyles(this.props, this.context, this.state);
const sliderStyles = Object.assign({}, styles.root, style);
const sliderStyles = Object.assign({}, styles.slider);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Object.assign is no longer useful.

@oliviertassinari
Copy link
Copy Markdown
Member

oliviertassinari commented Apr 30, 2016

how likely is it someone is depending on the style prop being removed here?

I would say the probability is low and I would consider this a bug before all.

@tintin1343 Could you have a look at my comment? It would be good to merge this PR before releasing v0.15.0.

@tintin1343
Copy link
Copy Markdown
Contributor Author

@oliviertassinari : Sorry for the delay, was out of action for a couple days. I will get back to you on this.

@tintin1343
Copy link
Copy Markdown
Contributor Author

@oliviertassinari : I remove Object.assign() . Do Check it.

@oliviertassinari
Copy link
Copy Markdown
Member

@tintin1343 That looks good to me. Could you squash?

@tintin1343
Copy link
Copy Markdown
Contributor Author

@oliviertassinari : Done.

@sghall
Copy link
Copy Markdown
Contributor

sghall commented May 13, 2016

Well, I was depending on the style prop for the Slider. Why is the default bottom margin 48px? That's seems ridiculously large, that's all I was trying to change. Great work project BTW!

@oliviertassinari
Copy link
Copy Markdown
Member

oliviertassinari commented May 13, 2016

Why is the default bottom margin 48px?

I would even go further. Why do we have a default margin?

Well, I was depending on the style prop for the Slider.

We have many customization points on the others components. You could submit a PR to add a sliderStyle property.

@zannager zannager added the scope: slider Changes related to the slider. label Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: slider Changes related to the slider.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Slider] Unexpected result when set style.width to %-value

5 participants