Skip to content

Some events doesn't work since listener multiplexer update #2061

@KarlitosVII

Description

@KarlitosVII

Problem
Hello,
I didn't test all events so some may also be bugged, but since 68d2fdb onblur and onscroll doesn't works. onfocusout can be used in place of onblur but there is no equivalent for the onscroll event.

Steps To Reproduce

use gloo::console;
use yew::prelude::*;

pub struct Model;

impl Component for Model {
    type Message = ();
    type Properties = ();

    fn create(_ctx: &Context<Self>) -> Self {
        Self
    }

    fn view(&self, ctx: &Context<Self>) -> Html {
        let onblur = ctx.link().callback(|_| {
            console::log!("Blur"); // Doesn't works
        });
        let onfocusout = ctx.link().callback(|_| {
            console::log!("Focus out"); // Works
        });
        let onscroll = ctx.link().callback(|_| {
            console::log!("Scroll"); // Doesn't works
        });
        html! {
            <>
                <button {onblur} {onfocusout}>{"Click me then click outside"}</button>
                <div style="height: 500px; overflow-y:auto" {onscroll}>
                    <div style="height: 1000px">{"Scroll me"}</div>
                </div>
            </>
        }
    }
}

fn main() {
    yew::start_app::<Model>();
}

Environment:

  • Yew version: master
  • Rust version: 1.54.0
  • Browser: tested on latest Firefox and Edge

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions