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

[Tooltip] Fix className not getting applied from PopperProps #29023

Merged

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Oct 13, 2021

Closes #28991

As per this #28692 (comment) the PopperProps take precedence over the componentsProps.popper.

I am not sure why we have both PopperProps and componentsProps.popper. Maybe PopperProps was not removed to avoid breaking changes.

CodeSandbox after the fix.

@ZeeshanTamboli ZeeshanTamboli added bug 🐛 Something doesn't work component: tooltip This is the name of the generic UI component, not the React module! labels Oct 13, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Oct 13, 2021

Details of bundle changes

Generated by 🚫 dangerJS against 3c83490

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

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

Good catch

packages/mui-material/src/Tooltip/Tooltip.test.js Outdated Show resolved Hide resolved
packages/mui-material/src/Tooltip/Tooltip.js Outdated Show resolved Hide resolved
@ZeeshanTamboli ZeeshanTamboli marked this pull request as ready for review October 13, 2021 06:45
@ZeeshanTamboli
Copy link
Member Author

If somebody gets time, this can be reviewed further.

Copy link
Member

@michaldudak michaldudak left a comment

Choose a reason for hiding this comment

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

Thanks!

@ZeeshanTamboli
Copy link
Member Author

ZeeshanTamboli commented Oct 21, 2021

@michaldudak
I have four questions, maybe out of the scope of this PR.

  1. Should we pass and support className for TransitionComponent as well like for PopperComponent?

Current TransitionComponent:
https://github.com/mui-org/material-ui/blob/d11ef0f82f1ef6d62518f0879b674feb9f916d66/packages/mui-material/src/Tooltip/Tooltip.js#L686-L689

PopperComponent (after fix):
https://github.com/ZeeshanTamboli/material-ui/blob/ffb9389ede1b2c782b6110e9aae1ab9375242a29/packages/mui-material/src/Tooltip/Tooltip.js#L681-L682
Maybe it would cause issues later for TransitionProps.className.

  1. Should we mark TransitionComponent, PopperComponent, TransitionProps and PopperProps deprecated? (@deprecated)
  2. For native className prop we allow it from both componentProps and PopperProps, but say in the docs that one take precedence over another. Should we add except for className?
  3. For latest preview codesandbox of this PR: https://codesandbox.io/s/popperprops-issue-o0wkg?file=/src/App.tsx, the style now gets applied fixing the issue linked but the popper type fails as open prop is required in PopperProps. I doubt there should be an open prop required with an already open tooltip.

@michaldudak
Copy link
Member

Should we pass and support className for TransitionComponent as well like for PopperComponent?

Yes, we should.

Should we mark TransitionComponent, PopperComponent, TransitionProps and PopperProps deprecated?

I suppose we can. @mnajdova any thoughts on this?

For native className prop we allow it from both componentProps and PopperProps, but say in the docs that one take precedence over another. Should we add except for className?

Yep, good idea.

For latest preview codesandbox of this PR: https://codesandbox.io/s/popperprops-issue-o0wkg?file=/src/App.tsx, the style now gets applied fixing the issue linked but the popper type fails as open prop is required in PopperProps. I doubt there should be an open prop required with an already open tooltip.

Good catch. The componentsProps.popper type should be Partial<PopperProps> & TooltipComponentsPropsOverrides. Would you be willing to create a PR?

@eps1lon eps1lon removed their request for review October 25, 2021 09:26
@mnajdova
Copy link
Member

I suppose we can. @mnajdova any thoughts on this?

I would say it's too early now, but we can add in our v6 milestone to remove those and add the deprecation warnings closer before we actually release v6. Adding new deprecation warnings in the 5.0.x it's too much :)

@ZeeshanTamboli
Copy link
Member Author

ZeeshanTamboli commented Oct 28, 2021

Should we pass and support className for TransitionComponent as well like for PopperComponent?

Yes, we should.

For native className prop we allow it from both componentProps and PopperProps, but say in the docs that one take precedence over another. Should we add except for className?

Yep, good idea.

For latest preview codesandbox of this PR: https://codesandbox.io/s/popperprops-issue-o0wkg?file=/src/App.tsx, the style now gets applied fixing the issue linked but the popper type fails as open prop is required in PopperProps. I doubt there should be an open prop required with an already open tooltip.

Good catch. The componentsProps.popper type should be Partial<PopperProps> & TooltipComponentsPropsOverrides. Would you be willing to create a PR?

I can fix these three points in a new PR after we merge this.

@michaldudak michaldudak merged commit e8312d3 into mui:master Oct 28, 2021
@michaldudak
Copy link
Member

Thanks for your work on this!

@ZeeshanTamboli ZeeshanTamboli deleted the issue-28991-tooltip-className-PopperProps branch October 28, 2021 08:58
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: tooltip 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.

[Tooltip] className not applied from PopperProps
5 participants