use_active_element
Reactive document.activeElement
Demo
Usage
use leptos::*;
use leptos::logging::log;
use leptos_use::use_active_element;
#[component]
fn Demo() -> impl IntoView {
let active_element = use_active_element();
create_effect(move |_| {
log!("focus changed to {:?}", active_element.get());
});
view! { }
}
Server-Side Rendering
On the server this returns a Signal
that always contains the value None
.
Feature
This function is only available if the crate feature
use_active_element
is enabled