Change how to prevent default events
See original GitHub issueRight now if you add a custom event handler (like onKeyDown
to the getInputProps
for example), you can prevent the default behavior with event.preventDefault()
. This has worked pretty well, but honestly it’s overloading the feature of preventing the default from events so we should come up with another way to signal preventing the default behavior.
What if instead you simply add a property to the event like: event.preventDownshiftDefault = true
and then downshift references that rather than event.defaultPrevented
?
I think that’d be pretty simple and straightforward and the upgrade for this breaking change would be pretty smooth. In fact, we could support both for a little while without much trouble.
Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Event.preventDefault() - Web APIs | MDN
The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default ...
Read more >javascript - preventDefault() not working for change event
By using evt.preventDefault(evt) inside a click event you can stop the default behaviour so that you can do other operations before you action ......
Read more >preventDefault() Event Method
The preventDefault() method cancels the event if it is cancelable, meaning that the default action that belongs to the event will not occur....
Read more >event.preventDefault() | jQuery API Documentation
event.preventDefault()Returns: undefined. Description: If this method is called, the default action of the event will not be triggered.
Read more >How to Manage Browser Defaults with event. ...
This method prevents default actions that browsers make when an event is triggered. Here are some examples of default actions on webpages and ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@kimgronqvist you missed a pair of
{}
to destructureonKeyDown
fromgetInputProps
😛 :link with the fix
thanks!
Sure! This example conveys the general idea: https://codesandbox.io/s/zx9z9275xm