Struct freya_hooks::UseFocus
source · pub struct UseFocus { /* private fields */ }
Expand description
Manage the focus operations of given Node
Implementations§
source§impl UseFocus
impl UseFocus
pub fn new_id() -> AccessibilityId
sourcepub fn request_focus(&mut self)
pub fn request_focus(&mut self)
Request to focus accessibility node. This will not immediately update Self::is_focused.
sourcepub fn request_unfocus(&mut self)
pub fn request_unfocus(&mut self)
Request to unfocus accessibility node. This will not immediately update Self::is_focused.
sourcepub fn attribute(&self) -> AttributeValue
pub fn attribute(&self) -> AttributeValue
Create a freya_elements::elements::rect::a11y_id attribute value for this accessibility node.
sourcepub fn attribute_for_id(id: AccessibilityId) -> AttributeValue
pub fn attribute_for_id(id: AccessibilityId) -> AttributeValue
Create a freya_elements::elements::rect::a11y_id attribute value for a given [AccessibilityId].
sourcepub fn is_focused(&self) -> bool
pub fn is_focused(&self) -> bool
Subscribe to focus changes where this node was involved.
sourcepub fn is_focused_with_keyboard(&self) -> bool
pub fn is_focused_with_keyboard(&self) -> bool
Subscribe to focus changes where this node was involved and the keyboard was used.
sourcepub fn validate_keydown(&self, e: &KeyboardEvent) -> bool
pub fn validate_keydown(&self, e: &KeyboardEvent) -> bool
Useful if you want to trigger an action when Enter
or Space
is pressed and this Node was focused with the keyboard.
Prevent navigating the accessible nodes with the keyboard.
You must use this this inside of a onglobalkeydown
event handler.
sourcepub fn focused_id(&self) -> ReadOnlySignal<AccessibilityId>
pub fn focused_id(&self) -> ReadOnlySignal<AccessibilityId>
Get a readable of the currently focused Node Id.
sourcepub fn focused_node(&self) -> ReadOnlySignal<AccessibilityNode>
pub fn focused_node(&self) -> ReadOnlySignal<AccessibilityNode>
Get a readable of the currently focused Node.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UseFocus
impl !RefUnwindSafe for UseFocus
impl !Send for UseFocus
impl !Sync for UseFocus
impl Unpin for UseFocus
impl !UnwindSafe for UseFocus
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more