From 0b9911b2e6302c89b73e5c07bb77a2bb1dd85e8c Mon Sep 17 00:00:00 2001 From: jprochazk <1665677+jprochazk@users.noreply.github.com> Date: Wed, 29 May 2024 12:32:30 +0200 Subject: [PATCH] docs for `focused_element` + add `has_focus` helper --- crates/eframe/src/web/mod.rs | 22 +++++++++++++++++++--- crates/eframe/src/web/text_agent.rs | 3 +-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/crates/eframe/src/web/mod.rs b/crates/eframe/src/web/mod.rs index 1963795f126..e5cdab9ad7d 100644 --- a/crates/eframe/src/web/mod.rs +++ b/crates/eframe/src/web/mod.rs @@ -53,11 +53,27 @@ pub(crate) fn string_from_js_value(value: &JsValue) -> String { value.as_string().unwrap_or_else(|| format!("{value:#?}")) } -pub(crate) fn focused_element() -> Option { +/// Returns the `Element` with active focus. +/// +/// Elements can only be focused if they are: +/// - ``/`` with an `href` attribute +/// - ``/`