-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Declare event listeners as non-passive to remove browser warnings #4437
Conversation
🦋 Changeset detectedLatest commit: 7891f32 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7891f32:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I took a look and there is a backwards compatibility concern here with older browsers -- https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
Off the top of my head I'm not confident that this wouldn't cause a problem for browsers that react-select supports in the wild, so unless we wait for a major release, I'd be more comfortable if we added the compatibility check in here.
(note: with the next major version we should really clarify our browser support so stuff like this doesn't come up again! I think evergreen is fair these days, and IE is dead, but when we rewrote for v2 IE11 was still actually a target for Atlassian so unless someone knows other reasons it wouldn't still work on IE, it may, and if so people using it may also be relying on that 🤷♂️)
@JedWatson Thanks for the heads up on that and I did miss that consideration, though I did see this was something that had been explored before. This may be a case where we'd like to include the polyfill and consider removing it for some major release. I understand the warnings are fairly innocuous, but ultimately it reflects poorly on on the devs using react-select to have Chrome console spamming 3 warning messages every time a menu is opened. |
@JedWatson , I added a polyfill to support legacy browsers. Also in regards to these... react-select/packages/react-select/src/internal/useScrollCapture.js Lines 106 to 115 in 9aaf35b
I know I am fairly new to Flow, but the events are being attached directly to the DOM, so wouldn't they be actual Wheel/Touch events and not synthetic events? |
Problem:
Issue: non-passive event listener in scroll blocking events #2729
Chrome issues console warnings when adding some event listeners without declaring them as passive. Three of these warnings present themselves in a non-mobile view when opening the menu.
Resolution:
By explicitly setting passive is false, Chrome will no longer show this warning in the console.