#[non_exhaustive]pub enum KeyCapture {
None,
All,
Keys(Arc<[Keystroke]>),
Text,
}Expand description
The keys a view consumes before the platform’s native defaults run
(crate::element::Interactive::capture_keys).
A view mounts one as a reactive prop; the platform reads the mounted rule of the focused view and its ancestry and decides without waiting for a listener. An eligible app shortcut keeps its priority, and a native input or child keeps its own keys. Disabled views, and views that left the focused view’s ancestry, capture nothing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
None
Nothing is captured (the default).
All
Every key is captured, named and modifier keys included.
Keys(Arc<[Keystroke]>)
The listed keys are captured: each canonical Keystroke matches
the same key and exactly its modifiers.
Text
Typing moves into the view’s first enabled text Input: a key that
would type text (a character, a dead key, or a key an input method
composes; not Space, which activates a focused button) with no
Control, Alt or platform modifier (macOS’s Option, which types
characters there, still moves), pressed while a non-input view
inside this one has the keyboard, focuses that input and is
delivered to it before any native default, so the input method and
dead keys compose there as if the input had been focused.
Other keys are not captured. A chat screen’s selectable transcript
uses it so the first key typed goes to the message field.
Implementations§
Source§impl KeyCapture
impl KeyCapture
Sourcepub fn keys(keys: impl IntoIterator<Item = Keystroke>) -> Self
pub fn keys(keys: impl IntoIterator<Item = Keystroke>) -> Self
A rule capturing keys (each a Keystroke’s key and modifiers,
both exact).
Trait Implementations§
Source§impl Clone for KeyCapture
impl Clone for KeyCapture
Source§impl Debug for KeyCapture
impl Debug for KeyCapture
Source§impl Default for KeyCapture
impl Default for KeyCapture
impl Eq for KeyCapture
Source§impl HostValue for KeyCapture
"none", "all", "text", or the canonical keystrokes a view captures
("mod+k", "shift+tab"): parsed once here with the shortcut rules
and this platform’s mod, which the engine’s environment names
(crate::element::try_apple_keys); a JS host decoding outside that
environment calls [crate::js::host::decode_capture_keys] with its own
convention.
Another string clears the rule with a warning; an invalid keystroke in
the array is reported and left out.
impl HostValue for KeyCapture
"none", "all", "text", or the canonical keystrokes a view captures
("mod+k", "shift+tab"): parsed once here with the shortcut rules
and this platform’s mod, which the engine’s environment names
(crate::element::try_apple_keys); a JS host decoding outside that
environment calls [crate::js::host::decode_capture_keys] with its own
convention.
Another string clears the rule with a warning; an invalid keystroke in
the array is reported and left out.
Source§impl IntoReactive<KeyCapture> for KeyCapture
impl IntoReactive<KeyCapture> for KeyCapture
Source§fn into_reactive(self) -> Reactive<KeyCapture>
fn into_reactive(self) -> Reactive<KeyCapture>
Reactive.