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

[Rating] Simpler customization of active "no value" styles #22613

Merged
merged 3 commits into from
Sep 16, 2020

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Sep 16, 2020

BREAKING CHANGE:
Customization of pristine label

-input:focus + .MuiRating-pristine {
+.MuiRating-labelEmptyValueActive {
    top: 0;
    bottom: 0;
    position: absolute;
    outline: 1px solid #999;
    width: 100%;
}

Preliminary change which isn't required for this change but aids communication of intent: Replace pristine with empty value.
Pristine is an existing term in forms and means "untouched" or "unchanged". Right now keep using a class named pristine even if the user has interacted with the input. This can be confusing.

Actual change:
We usually try to use class names for styling. This allows easier customization via classes API and reduces specificity wars. However, previously styling of the Rating when no rating was given required a combination of class name, sibling and pseudo class selector i.e. knowledge of implementation. This change introduces a single class (labelEmptyValueActive) which replaces the old selector. It requires more JS for the styling but less for the label-value association since we can now rely on association by hierarchy instead of by ID.

@eps1lon eps1lon added new feature New feature or request breaking change component: rating This is the name of the generic UI component, not the React module! labels Sep 16, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Sep 16, 2020

Details of bundle changes

Generated by 🚫 dangerJS against f4f7ab1

@eps1lon eps1lon marked this pull request as ready for review September 16, 2020 09:10
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@eps1lon eps1lon merged commit 8b8f8ee into mui:next Sep 16, 2020
@eps1lon eps1lon deleted the fix/Rating/pristine-vs-no-value branch September 16, 2020 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: rating This is the name of the generic UI component, not the React module! new feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants