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

[SpeedDial] Crash when using custom style in FabProps of SpeedDialAction #18312

Closed
rahuliet opened this issue Nov 11, 2019 · 2 comments · Fixed by #18320
Closed

[SpeedDial] Crash when using custom style in FabProps of SpeedDialAction #18312

rahuliet opened this issue Nov 11, 2019 · 2 comments · Fixed by #18320
Labels
bug 🐛 Something doesn't work component: speed dial This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@rahuliet
Copy link

While working on SpeedDial component of React's Material UI the following is needed:

  1. Change the background color of speeddial button
  2. Change the background color of speeddialactions
  3. Change the font size of tooltip displayed on hover over speeddialactions

All this was done successfully earlier with the following dependencies at sandbox URL for working code

  • material-ui/core 4.1.3
  • material-ui/lab 4.0.0.alpha.18

But now with latest packages I have updated code posted here sandbox URL for semi working code where things are getting bumpy

  • material-ui/core 4.6.0
  • material-ui/lab 4.0.0.alpha.31
    when hovered over speeddialaction there is an error that causes the SpeedDial to disappear. Error details can be seen in the console of sandbox URL for semi working code
@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work good first issue Great for first contributions. Enable to learn the contribution process. component: speed dial This is the name of the generic UI component, not the React module! labels Nov 11, 2019
@oliviertassinari oliviertassinari changed the title When used together, TooltipClasses and FabProps are not working for SpeedDialAction in Material UI React [SpeedDial] Crash when using custom style in FabProps Nov 11, 2019
@oliviertassinari
Copy link
Member

@rahuliet Thank you for this bug report. I can confirm the exception. What do you think of this diff?

diff --git a/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js b/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js
index 545d82adb..31411da6b 100644
--- a/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js
+++ b/packages/material-ui-lab/src/SpeedDialAction/SpeedDialAction.js
@@ -80,7 +80,7 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {
     classes,
     className,
     delay = 0,
-    FabProps,
+    FabProps = {},
     icon,
     id,
     open,
@@ -101,21 +101,18 @@ const SpeedDialAction = React.forwardRef(function SpeedDialAction(props, ref) {
     setTooltipOpen(true);
   };

-  const transitionStyle = { transitionDelay: `${delay}ms` };
-
-  if (FabProps && FabProps.style) {
-    FabProps.style.transitionDelay = `${delay}ms`;
-  }
-
   const fab = (
     <Fab
       size="small"
       className={clsx(classes.fab, !open && classes.fabClosed, className)}
       tabIndex={-1}
       role="menuitem"
-      style={transitionStyle}
       aria-describedby={`${id}-label`}
       {...FabProps}
+      style={{
+        transitionDelay: `${delay}ms`,
+        ...FabProps.style,
+      }}
     >
       {icon}
     </Fab>

Do you want to submit a pull request? :)

@rahuliet
Copy link
Author

This is fixed now in alpha32 release..thanks :)

@rahuliet rahuliet changed the title [SpeedDial] Crash when using custom style in FabProps [SpeedDial] Crash when using custom style in FabProps of SpeedDialAction Nov 12, 2019
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: speed dial This is the name of the generic UI component, not the React module! good first issue Great for first contributions. Enable to learn the contribution process.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants