#[repr(C, u8)]pub enum DefaultAction {
FocusNext,
FocusPrevious,
FocusFirst,
FocusLast,
ClearFocus,
ActivateFocusedElement {
target: DomNodeId,
},
SubmitForm {
form_node: DomNodeId,
},
CloseModal {
modal_node: DomNodeId,
},
ScrollFocusedContainer {
direction: ScrollDirection,
amount: ScrollAmount,
},
SelectAllText,
None,
}Expand description
Default actions are built-in behaviors that occur in response to events.
Per W3C DOM Event specification:
A default action is an action that the implementation is expected to take in response to an event, unless that action is cancelled by the script.
Examples:
- Tab key → move focus to next focusable element
- Enter/Space on button → activate (click) the button
- Escape → clear focus or close modal
- Arrow keys in listbox → move selection
Default actions are processed AFTER all event callbacks have been invoked,
and only if event.prevent_default() was NOT called.
Variants§
FocusNext
Move focus to the next focusable element (Tab key)
FocusPrevious
Move focus to the previous focusable element (Shift+Tab)
FocusFirst
Move focus to the first focusable element
FocusLast
Move focus to the last focusable element
ClearFocus
Clear focus from the currently focused element (Escape key)
ActivateFocusedElement
Activate the focused element (Enter/Space on activatable elements) This generates a synthetic Click event on the target
SubmitForm
Submit the form containing the focused element (Enter in form input)
CloseModal
Close the current modal/dialog (Escape key when modal is open)
ScrollFocusedContainer
Scroll the focused scrollable container
SelectAllText
Select all text in the focused text input (Ctrl+A / Cmd+A)
None
No default action for this event
Trait Implementations§
Source§impl Clone for DefaultAction
impl Clone for DefaultAction
Source§fn clone(&self) -> DefaultAction
fn clone(&self) -> DefaultAction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DefaultAction
impl Debug for DefaultAction
Source§impl Hash for DefaultAction
impl Hash for DefaultAction
Source§impl PartialEq for DefaultAction
impl PartialEq for DefaultAction
impl Eq for DefaultAction
impl StructuralPartialEq for DefaultAction
Auto Trait Implementations§
impl Freeze for DefaultAction
impl RefUnwindSafe for DefaultAction
impl Send for DefaultAction
impl Sync for DefaultAction
impl Unpin for DefaultAction
impl UnsafeUnpin for DefaultAction
impl UnwindSafe for DefaultAction
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§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