Material-ui: [SpeedDial] SpeedDialAction onClick not working when you click the touch screen

Created on 26 Sep 2018  路  8Comments  路  Source: mui-org/material-ui

  • [ 鉁擼 This is not a v0.x issue.
  • [鉁擼 I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

SpeedDialAction onClick should trigger when click the actions.

Current Behavior

For the laptop with touch screen, it works fine for touch event, but not works when you get a mouse and click it.

Steps to Reproduce

Just run the example https://material-ui.com/lab/speed-dial/ on touch screen with the mouse click.

Link:

1.
2.
3.
4.

Context

Your Environment

| Tech | Version |
|--------------|---------|
| Material-UI | v3.1.1 |
| React | v16.4.2 |
| Browser | Chrome v69 |
| material-ui/lab | 3.0.0-alpha.17 |

SpeedDial

Most helpful comment

Hi - I have looked into this particular case, and it appears that the onClick parameter is not passed along to Button component in SpeedDialAction if device is touch capable.

This was introduced by the following commit: https://github.com/mui-org/material-ui/commit/3db734f547cd755b01ad3009e4216478491cc335

Below is a screenshot from the commit showing that onClick is not passed to Button:
image

At least clickProps should also contain onMouseDown: onClick.

All 8 comments

Hi - I have looked into this particular case, and it appears that the onClick parameter is not passed along to Button component in SpeedDialAction if device is touch capable.

This was introduced by the following commit: https://github.com/mui-org/material-ui/commit/3db734f547cd755b01ad3009e4216478491cc335

Below is a screenshot from the commit showing that onClick is not passed to Button:
image

At least clickProps should also contain onMouseDown: onClick.

hi,

would be great to get a fix for this. with this implementation our surface-book cannot click anymore on the button. you have to touch it.

a little strange for the users ...

Are we able to get a fix for this?

We're still seeing this issue. I've had to set up custom behavior (showing the content on hover rather than on click) if that document.documentElement.ontouchstart prop exists) in order to work around this for some users.

Has anyone seen newer Macbooks experiencing this issue in Chrome due to the Touchbar?

No; I use a macbook with the touchbar at work, but the issue doesn't happen for me. I think it's due to the fact that my document.documentElement doesn't have the ontouchstart attribute.

I'm seeing the same behavior is is described above. The event isn't being passed to the button on touch capable devices. Its coming up as undefined.

one fix for me was passing the onClick via the ButtonProps see SpeedDialAction.js#L133

<SpeedDialAction
    key={'do-something'}
    icon={<EditIcon />}
    tooltipTitle={'Do something'}
    tooltipOpen
    // onClick={(e) => this.doAction(e)}
    ButtonProps={{
        onClick: (e) => this.doAction(e)
    }}
    />
Was this page helpful?
0 / 5 - 0 ratings

Related issues

reflog picture reflog  路  3Comments

anthony-dandrea picture anthony-dandrea  路  3Comments

activatedgeek picture activatedgeek  路  3Comments

sys13 picture sys13  路  3Comments

finaiized picture finaiized  路  3Comments