Using event.preventDownshiftDefault = true triggers React warning
See original GitHub issuedownshift
version: 1.31.2node
version: 8.9.4npm
(oryarn
) version: npm 5.8.0
Relevant code or config
{...getItemProps({
onClick: event => {
event.preventDownshiftDefault = true;
},
item,
label: item,
})}
What you did: I was preventing the default downshift handler from executing.
What happened: React triggered a warning
index.js:2178 Warning: This synthetic event is reused for performance reasons. If you’re seeing this, you’re adding a new property in the synthetic event object. The property is never released. See https://fb.me/react-event-pooling for more information. Reproduction repository:
Problem description: Functionality works as expected, but not sure if the warning can be prevented. Suggested solution: If warning is normal for Dev mode, add a note to docs.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:6 (3 by maintainers)
Top Results From Across the Web
React & event.preventDefault() - Medium
When React starts up, it starts listening for all events at the top level using a single event listener. So, this is great...
Read more >downshift/README.md - UNPKG
55, Downshift has proven to be a versatile React component which can be used not ... you can set the event's `preventDownshiftDefault` property...
Read more >Combobox Primitive - Paste: The Design System for building ...
Use an input element and set the role of Combobox in the getToggleButtonProps getter ... you can set the event's preventDownshiftDefault property to...
Read more >Is there a way to prevent an event to be triggered based on a ...
onClick="..." : null>Test</div> . Of course, this doesn't work. Is this possible? P.S. Remember, I am using React, this code is just an...
Read more >Downshift: The Answer to Building Accessible and Visually ...
In the realm of React UI Component Frameworks, there are lots of ... The use of render prop is at the core of...
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
Just stumbled upon this aswell. An other issue that appears is that on subsequent events (like keydown), the
event.preventDownshiftDefault = true
is still set (as the react warning suggests). So for example keydown navigation doesnt work anymore. For now, i’m setting it to false in the else clause:@kentcdodds I thought to myself: “The feature has been out for almost a month. I’m must doing something wrong, hahaha”. BTW, Downshift is awesome. I’ve just been getting familiar with it in the past day or so. I’ll dig up ticket on why event.preventDefault is not a good option.