Material-ui: [Button] Disabled Button still calling onClick

Created on 25 May 2017  路  7Comments  路  Source: mui-org/material-ui

I'm seeing behavior in the next/Button widget where disabled buttons are still calling onClick. The buttons appear visually disabled. Occurs in the simplest case:

<Button onClick={() => console.log('just got clicked')} disabled>Click Me</Button>
bug 馃悰 Button

Most helpful comment

@ng-hai Yes, you should.

All 7 comments

Thanks for the report. I'm on it 馃憤 .

onTouchTap still invoke when disabled

<Button
  raised
  disabled={!this.state.email}
  color='primary'
  className={classes.button}
  onTouchTap={this.getCode}
>
  Get Verification Code
</Button>

@ng-hai onTouchTap is no longer supported.

Is it OK if I remove react-tap-event-plugin when using v1-alpha version?

@ng-hai Yes, you should.

What is the alternative of onClick and onTouchTap?

Because typescript throw error "'IntrinsicAttributes & ButtonProps & { children?: ReactNode; }'."

@oliviertassinari Is there a handler still fired even when the button is disabled? I want to add handling to highlight missing fields on a form.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ryanflorence picture ryanflorence  路  3Comments

pola88 picture pola88  路  3Comments

rbozan picture rbozan  路  3Comments

revskill10 picture revskill10  路  3Comments

newoga picture newoga  路  3Comments