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

Can this work as a submit button in a form? #4

Closed
danoc opened this issue Nov 22, 2018 · 3 comments
Closed

Can this work as a submit button in a form? #4

danoc opened this issue Nov 22, 2018 · 3 comments

Comments

@danoc
Copy link
Owner

danoc commented Nov 22, 2018

No description provided.

@danoc
Copy link
Owner Author

danoc commented Dec 9, 2018

In this example, clicking on the button automatically runs onSubmit.

<form onSubmit={onSubmit}>
    <input />
    <input />
    <button type="submit">
        Submit
    </button>
</form>

In this example, it does not:

<form onSubmit={onSubmit}>
    <input />
    <input />
    <button type="button">
        Submit
    </button>
</form>

With ClickableBox, users need to provide the onClick prop for it to behave like the first example.

<form onSubmit={onSubmit}>
    <input />
    <input />
    <ClickableBox onClick={onSubmit}>
        Submit
    </ClickableBox>
</form>

I don't think this is a big deal since onClick is required. Also, submit buttons are usually styled like classic buttons, so ClickableBox likely isn't needed anyways.

@danoc danoc closed this as completed Dec 9, 2018
@gnapse
Copy link

gnapse commented Dec 11, 2018

Perhaps it should be mentioned in the README as one of the conditions under which this should not be used?

@danoc
Copy link
Owner Author

danoc commented Dec 11, 2018

Good idea! Added it here: 09153a2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants