-
-
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
[ButtonBase] Remove dead style #15503
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Could you revert this change? I believe that removing the !important style that overrides the inline style should be enough.
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.
Are you suggesting we keep the inline styles in addition to the new class?
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.
Do you confirm that we only need #15503 (comment) to solve the problem?
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 would rather use inline style than the style function (in our case).
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.
Oh, I see what you are saying. No, that resolves the need to use the index option on makeStyles, but it would not resolve my issue without the rest of the changes. I have to run my code on websites with crazy garbage like
span { width: 200px !Important; }
set in their stylesheets. So I have to clean that up in my namespace with a reset including things like.myNamespace * { width: auto !important; }
.What is the aversion to moving to a style function, performance? Just seems like it would be nice to solve the CSP issue and allow any sort of preprocessing to run on these styles that users would like.
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.
Thanks for the extra detail, I better understand the problem now. There is close to no performance implication in this case, but it will once it's made a systematic solution. We might be able to use CSS variables in v5 (#14420). I have reverted the change of this file.
Did you consider using the shadow DOM?
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 would love to be using shadow DOM, it is perfect for my use case. I may implement it for most users again soon (past attempted this in MUI 0.x and ran into too many issues).
That said, unfortunately we have a ton of IE11 and Edge users. The polyfill basically does what I am doing with my jss plugins, namespaces all of the CSS. So in those browsers I will still have this issue.
I understand not wanting to pull in this change, I will probably just patch it locally for now. Would you mind giving some insight into where you think I will hit a performance issue when changing the other cases of inline style usage?
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 can imagine that supporting IE 11 is important for you, shadow DOM is not an option. Dropping IE 11 would also enable CSS variables and probably solve the issue here at the same time.
I'm curious why is dynamically creating an iframe is not an option for you? We do it for a few of our demos in the documentation, e.g. the Drawers' demos. If you are familiar with Stripe, it's how they increase the security of their web input widget.
Using style functions is slower. If it's only 10% slower (end-to-end), it worth it, 💯 ! It would unlock a lot of interesting features for Material-UI. I'm happy to push this further but in a different pull request. Removing the dead CSS rules is already an improvement :).
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.
This discussion echos with the one of #15499 as it requires the usage of style functions in the core components.