I am wanting to disable the default mouseover/hover behaviour of Material-UI's SpeedDial ponent (/). Currently when you mouseover the primary icon, the SpeedDial ponent will open. It will also open on click. This has caused issues with some of our users as when they mouse over the button - it opens - and they immediately click and it closes.
I would like to keep the just the click action for opening the SpeedDial for touch screen devices.
Is there a simple way for me to disable the hover/mouseover event? As far as I can tell the API does not allow this.
Thanks!
I am wanting to disable the default mouseover/hover behaviour of Material-UI's SpeedDial ponent (https://material-ui./api/speed-dial/). Currently when you mouseover the primary icon, the SpeedDial ponent will open. It will also open on click. This has caused issues with some of our users as when they mouse over the button - it opens - and they immediately click and it closes.
I would like to keep the just the click action for opening the SpeedDial for touch screen devices.
Is there a simple way for me to disable the hover/mouseover event? As far as I can tell the API does not allow this.
Thanks!
Share Improve this question asked Nov 27, 2019 at 22:24 OJJOJJ 1231 silver badge11 bronze badges1 Answer
Reset to default 20This behaviour can be achieved by ignoring onOpen
prop and control the ponent with onClick
prop.
// Component code
const [open, setOpen] = React.useState(false);
const handleOpen = (event) => {
setOpen(!open);
};
return (
<SpeedDial
onClick={handleOpen}
open={open}
...
/>
);
You can see a working example here: https://codesandbox.io/s/material-demo-1lwci