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

[TreeView] Fix alpha usage with CSS variables #14969

Merged
merged 6 commits into from
Oct 16, 2024
Merged

Conversation

wangkailang
Copy link
Contributor

@wangkailang wangkailang commented Oct 15, 2024

Fixes #14349.

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Thank you for spotting this issue! 🙏

I've linked an example with an expected approach to such cases. 😉

@@ -24,26 +24,26 @@ const TreeItem2DragAndDropOverlayRoot = styled('div', {
style: {
marginLeft: 'calc(var(--TreeView-indentMultiplier) * var(--TreeView-itemDepth))',
borderRadius: theme.shape.borderRadius,
backgroundColor: alpha((theme.vars || theme).palette.primary.dark, 0.15),
backgroundColor: alpha(theme.palette.primary.dark, 0.15),
Copy link
Member

Choose a reason for hiding this comment

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

The correct solution can be found here:

backgroundColor: theme.vars
? `rgba(${theme.vars.palette.primary.mainChannel} / ${theme.vars.palette.action.selectedOpacity})`
: alpha(theme.palette.primary.main, theme.palette.action.selectedOpacity),

Would you be able to apply the necessary changes? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@LukasTy LukasTy added bug 🐛 Something doesn't work component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module! labels Oct 15, 2024
@wangkailang
Copy link
Contributor Author

#14349

@flaviendelangle
Copy link
Member

June noticed that in #14772, but nice to have it fixed independently 👌

@LukasTy LukasTy changed the title [TreeView] Alpha not support css variables [TreeView] Fix alpha usage with CSS variables Oct 16, 2024
...theme.applyStyles('dark', {
borderBottomColor: alpha((theme.vars || theme).palette.grey[900], 0.6),
borderBottomColor: theme.vars ? `rgba(${theme.vars.palette.grey[900]} / ${0.6})` : alpha(theme.palette.grey[900], 0.6),
Copy link
Member

Choose a reason for hiding this comment

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

@flaviendelangle @noraleonte could you double check if this is not an error? 🤔
It seems that this should maybe use grey[100] as in all other cases for the dark theme. 🤔
Now it does nothing... 🤷

@mui-bot
Copy link

mui-bot commented Oct 16, 2024

Deploy preview: https://deploy-preview-14969--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against 6edb383

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for taking care of it. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: tree view TreeView, TreeItem. This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[tree view] TreeItem2DragAndDropOverlay - Error: MUI: Unsupported var(--palette-primary-dark) color.
4 participants