-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
Scrollbar width padding misaligning pages caused by Menu + Tooltip #19203
Comments
With MacOS you have to set "Show scroll bars" to "Always" in System Preferences / General in order to see this issue. |
This problem seems to start appearing with version |
Forked the codesandbox: https://codesandbox.io/s/material-ui-issue-padding-menu-mwnze Changes:
|
This solved the issue for me: html { body { |
You are right, the behavior has changed between v4.6.1 (OK) and v4.7.0 (KO). It's related to the changes in What about this fix? diff --git a/packages/material-ui/src/Tooltip/Tooltip.js b/packages/material-ui/src/Tooltip/Tooltip.js
index 70829de9c..67f55a5f7 100644
--- a/packages/material-ui/src/Tooltip/Tooltip.js
+++ b/packages/material-ui/src/Tooltip/Tooltip.js
@@ -482,6 +482,19 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
}
}
+ // Avoid the creation of a new Popper.js instance at each render.
+ const popperOptions = React.useMemo(
+ () => ({
+ modifiers: {
+ arrow: {
+ enabled: Boolean(arrowRef),
+ element: arrowRef,
+ },
+ },
+ }),
+ [arrowRef],
+ );
+
return (
<React.Fragment>
{React.cloneElement(children, { ref: handleRef, ...childrenProps })}
@@ -495,14 +508,7 @@ const Tooltip = React.forwardRef(function Tooltip(props, ref) {
open={childNode ? open : false}
id={childrenProps['aria-describedby']}
transition
- popperOptions={{
- modifiers: {
- arrow: {
- enabled: Boolean(arrowRef),
- element: arrowRef,
- },
- },
- }}
+ popperOptions={popperOptions}
{...interactiveWrapperListeners}
{...PopperProps}
> |
Working on this. |
Current Behavior 😯
When using menu + menu items + tooltip: Opening the menu adds scrollbar width padding to the right side of the page and de-aligns all other elements.
Expected Behavior 🤔
No disalignement. No additional padding.
Steps to Reproduce 🕹
https://codesandbox.io/s/compassionate-keldysh-t4ebw?fontsize=14&hidenavigation=1&theme=dark
Note that the menu is duplicated only so that it can be seen better that items get shifted on open menu.
The text was updated successfully, but these errors were encountered: