Problem
No way to call prevent_default() for WheelEvent.
Steps To Reproduce
Steps to reproduce the behavior:
- Apply
diff --git a/examples/counter/src/main.rs b/examples/counter/src/main.rs
index 14242db1..20393c6c 100644
--- a/examples/counter/src/main.rs
+++ b/examples/counter/src/main.rs
@@ -57,7 +57,10 @@ impl Component for Model {
</div>
// Display the current value of the counter
- <p class="counter">
+ <p class="counter" onwheel={ctx.link().callback_with_passive(Some(false), |e: yew::WheelEvent| {
+ e.prevent_default();
+ Msg::Increment
+ })}>
{ self.value }
</p>
- Run the counter example
- Scroll on the counter to increment it
- Observe console errors saying how prevent default failed due to listener being passive
I suspect that this is caused by #1542 having been merged (it worked previously).
Note that I explicitly set the listener to be not passive by using callback_with_passive, but this seems to have no effect (regardless of what value I choose for its first argument). It also seems to be impossible to get explicitly non/passive listeners via Callback::from.
This not ideal because, on Firefox, ALT + mouse scrolling navigates back/forwards.
Expected behavior
prevent_default() works.
Environment:
- Yew version: current
master 77b46bf
- Rust version: 1.55
Problem
No way to call
prevent_default()forWheelEvent.Steps To Reproduce
Steps to reproduce the behavior:
I suspect that this is caused by #1542 having been merged (it worked previously).
Note that I explicitly set the listener to be not passive by using
callback_with_passive, but this seems to have no effect (regardless of what value I choose for its first argument). It also seems to be impossible to get explicitly non/passive listeners viaCallback::from.This not ideal because, on Firefox, ALT + mouse scrolling navigates back/forwards.
Expected behavior
prevent_default()works.Environment:
master77b46bf