downshift version: 1.16.1npm (or yarn) version: npm 5.5.1Relevant code or config
const App = () => (
<form>
<input type='text'/>
<Downshift>
{({isOpen, getButtonProps}) => (
<div>
<button {...getButtonProps()}>
ay
</button>
{isOpen &&
<div>
Yo wassup
</div>
}
</div>
)}
</Downshift>
</form>
);
What you did: Pressing [ENTER] on any input inside
@philipyoungg, It's not Downshift fault π€¨
https://codesandbox.io/s/wnm9zwqw0w
Pressing [ENTER] on any input element calls 'submit' event on form; If Button[type="submit"(by default)] is present in the form - before 'submit' event it will call 'click' event on this button.
How to Fix: in your Form. π€
Whoa didnβt know that before submitβform will click the button with type=submit.
Thanks @notruth!
Closing as this is not relevant anymore π
My co-worker has this same problem. Maybe we should explicitly return the type as button from getButtonProps unless it's overridden. I don't think anyone would want the button to submit the form.
@kentcdodds agreed.
Will it be appropriate to create a brunch with upcoming Button changes?
I also want to implement Button_focus() after reset
I also want to implement Button_focus() after reset
I don't think that's a common enough use case to make that the default. More common to want to focus the input I think...
Who wants to make a PR to add type: 'button' to this object?
Actually, this is a great first-timers-only issue... So I'm going to prepare it later today and only allow first-time OSS contributors to submit a PR for it :)
ππ₯β First Timers Only
This issue is reserved for people who never contributed to Open Source before. We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you π
π€ What you will need to know
Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you trough the process.
π Step by Step
downshift.js in the this repo by following the steps in the CONTRIBUTING.md guide. Please add type: 'button' above this line.closes #315 in the description.π€β Questions? Comment here :)
Hi, I would like to claim this issue please.
Congratulations @xutopia!
Most helpful comment
ππ₯β First Timers Only
This issue is reserved for people who never contributed to Open Source before. We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you π
About First Timers Only.
π€ What you will need to know
Nothing. This issue is meant to welcome you to Open Source :) We are happy to walk you trough the process.
π Step by Step
Please π only claim if you want to start working on it within a day.
In a nutshell: be patient and actively kind with us π
downshift.jsin the this repo by following the steps in the CONTRIBUTING.md guide. Please addtype: 'button'above this line.closes #315in the description.If this is your first, welcome π π Here is a great tutorial on how to send a pull request using the terminal.
π€β Questions? Comment here :)