Grommet: LoginForm's Button disabled status broken

Created on 8 Apr 2017  路  3Comments  路  Source: grommet/grommet

Commit f1b2a715b314f82c275fac92bafbdbb109863761, which made the Button component enabled when type=reset || submit to support more standard form submissions, appears to have introduced a bug on the LoginForm component.

On LoginForm, passing onSubmit={undefined} no longer disables the button - which makes the button look and be clickable, which results in a javascript error.

Expected Behavior

Passing prop onSubmit={undefined} on LoginForm should disable the Button.

Actual Behavior

Button always enabled because type='submit'

Steps to Reproduce

  1. Have LoginForm
  2. Pass onSubmit={undefined}
  3. Button can be clicked and trigger JS error

Fix thoughts:

Quick (and possibly dirty) fix is for LoginForm to toggle its Button type to button instead of submit when props.onSubmit is undefined.

Or, could introduce a disabled prop for Button, and pass it from the LoginForm.

I'll submit a PR for one of the above if you guys can provide a bit of feedback on approach... or another way of doing it.

Most helpful comment

I went ahead and fixed this using @alansouzati's vote. https://github.com/grommet/grommet/pull/1384

All 3 comments

thanks for proposing a fix for this. I believe for backwards compatibility sake, I would vote for changing the type of the button. Can you work on a pull request for this?

+1, this is annoying especially because if the login is taking a while, the form gives no feedback at all to the user.

I went ahead and fixed this using @alansouzati's vote. https://github.com/grommet/grommet/pull/1384

Was this page helpful?
0 / 5 - 0 ratings

Related issues

santaclauze picture santaclauze  路  3Comments

DanielBaird picture DanielBaird  路  3Comments

Kitanotori picture Kitanotori  路  4Comments

ezu picture ezu  路  4Comments

Primajin picture Primajin  路  4Comments