-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Fix default passive option #2111
Conversation
Could we add a way to make the result from |
yew/packages/yew/src/html/listener/events.rs Lines 211 to 216 in 77b46bf
We should add a way for users to create a passive Regardless, I think adding this should occur in a different PR and that PR should also include any other missing ways of constructing a |
I am slightly confused by what you said, as it seems as though |
Oh sorry! I meant in terms of the defaults yew uses. This PR is really letting yew override whatever default the browser might have - I think we assumed passive would be false unless set otherwise, but this doesn't seem to be the case, which is why we need to explicitly set the flag.
So for these three after this PR, they will still default to passive, unless the user explicitly sets the passive flag to false :) |
@siku2 sanity check please 🙃 |
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.
Weird, my memory tells me that the DOM Standard dictates the passive
flag to init to false.
Does this actually fix the issue?
It did for me - I used the example provided in #2110 and found that I got errors in both firefox and chrome, then implemented this change and it worked :)
"passive (a boolean, initially false)" - Your memory is correct 🙃. This feature seems to contradict what the standard says and this seems to apply to Edge as well, though I didn't test Edge. |
@mc1098 thanks a lot for checking! |
Description
This PR sets the passive option explicitly in order to override any defaults the browsers might have - this is especially needed because with #1542 we attach listeners to the body element which is at the document level.
See this article section about default passive behaviour on some document level events.
Fixes #2110
Checklist
cargo make pr-flow