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

[theme] Fix styleOverrides with nested selectors #25156

Merged
merged 7 commits into from
Mar 4, 2021

Conversation

ruppysuppy
Copy link
Contributor


Fixes: #25075

@mui-pr-bot
Copy link

mui-pr-bot commented Mar 2, 2021

Details of bundle changes

Generated by 🚫 dangerJS against f705a65

@ruppysuppy
Copy link
Contributor Author

How do I fix

AssertionError: expected computed style of <span data-index="0" class="MuiSlider-thumbColorPrimary MuiSlider-thumb emotion-client-render-txmhnk-MuiSlider-thumb" style="left: 0%;"><input data-index="0" aria-orientation="horizontal" aria-valuemax="100" aria-valuemin="0" aria-valuenow="0" type="range" value="0" style="border: 0px; clip: rect(0px, 0px, 0px, 0px); height: 100%; margin: -1px; overflow: hidden; padding: 0px; position: ; white-space: nowrap; width: 100%; direction: ltr;"></span> did not match
	Expected:
	{
	  "font-variant-caps": "all-petite-caps",
	  "mix-blend-mode": "darken"
	}
	Actual:
	{
	  "font-variant-caps": "all-petite-caps",
	  "mix-blend-mode": "normal"
	}

for the browsers the tests are failing for?

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work core Infrastructure work going on behind the scenes labels Mar 2, 2021
@oliviertassinari oliviertassinari changed the title [Slider] Updated style overriding [theme] Fix styleOverrides with nested selectors Mar 2, 2021
Copy link
Member

@oliviertassinari oliviertassinari left a comment

Choose a reason for hiding this comment

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

The failing test case come from the downside I have described in the issue with the first option. I think that we can start by keeping the deepmerge and update all the +90 migrated components to the second option. Then, we can chat about the tradeoff with Marija once she comes back and reevaluate.

@oliviertassinari
Copy link
Member

@ruppysuppy I have pushed an update trying the section option. It works. Do you want to update all the other components? I also think that we could consider a test case just for the Slider to assert that the fix works, it won't add a lot of value but could be as some level of defense for future regression.

oliviertassinari added a commit to m4theushw/material-ui that referenced this pull request Mar 3, 2021
oliviertassinari added a commit to m4theushw/material-ui that referenced this pull request Mar 3, 2021
@oliviertassinari oliviertassinari merged commit 3834108 into mui:next Mar 4, 2021
Comment on lines -14 to +24
return deepmerge(styles.root, {
...(!styleProps.formControl && styles.formControl),
...(styleProps.size === 'small' && styles.sizeSmall),
...(styleProps.shrink && styles.shrink),
...(!styleProps.disableAnimation && styles.animated),
...styles[styleProps.variant],
[`& .${formLabelClasses.asterisk}`]: styles.asterisk,
});
return deepmerge(
{
...(!styleProps.formControl && styles.formControl),
...(styleProps.size === 'small' && styles.sizeSmall),
...(styleProps.shrink && styles.shrink),
...(!styleProps.disableAnimation && styles.animated),
...styles[styleProps.variant],
[`& .${formLabelClasses.asterisk}`]: styles.asterisk,
},
styles.root || {},
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @oliviertassinari can you revisit this change again? This change causes a regression in our product.

After this change:

image

Revert this specific change in node_modules and it works well:

image

I can't tell why this is happening but it seems very strange.

Copy link
Member

Choose a reason for hiding this comment

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

@Jack-Works we changed how the styleOverrides work in the latest release alpha.32, can you try with this version? Also would be useful if you can share the code, preferably in an issue so that it would help other developers if they stumble upon it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Our product is open sourced but it's but hard to build and preview. If you'd like to have a try I can guide you how to setup the project. I'll try alpha 32 later, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Let's try alpha.32 and see, if not simple repro would be best for us to debug.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, I found we're already on alpha 32... I can try to make a reproduce but I doubt if I can make a simple repro

Copy link
Contributor

Choose a reason for hiding this comment

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

It appears to be a problem in our codebase. We overwrite MuiInputLabel in the theme. Remove them solves the problem

DimensionDev/Maskbook#3095

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Slider] Customize disabled state
5 participants