pub struct Semantics {Show 24 fields
pub role: Role,
pub label: Option<String>,
pub value: Option<String>,
pub actions: ActionSet,
pub focusable: bool,
pub multiline: bool,
pub masked: bool,
pub input_mask: Option<InputMask>,
pub ime_preedit_range: Option<(usize, usize)>,
pub checked: Option<bool>,
pub disabled: bool,
pub draggable: bool,
pub scrollable_x: bool,
pub scrollable_y: bool,
pub min_value: Option<f32>,
pub max_value: Option<f32>,
pub current_value: Option<f32>,
pub is_focus_scope: bool,
pub is_focus_barrier: bool,
pub drag_payload: Option<Vec<u8>>,
pub hero_tag: Option<String>,
pub focus_index: Option<i32>,
pub capture_tab: bool,
pub auto_indent: bool,
}Expand description
Accessibility and interaction metadata for a node.
Semantics is the IR’s way of describing what a node means rather than how it
looks or where it is positioned. It is consumed by:
- Assistive technology (screen readers, switch control) via the accessibility tree.
- The event/focus system, which uses
focusable,actions, anddisabledto route input. - The drag-and-drop subsystem, which reads
draggableanddrag_payload.
Most fields default to “inert” values (see Default impl), so you only need to
set the fields that matter for a given widget.
§Example
use fission_ir::Semantics;
use fission_ir::semantics::Role;
let sem = Semantics {
role: Role::Button,
label: Some("Submit".into()),
focusable: true,
..Semantics::default()
};Fields§
§role: RoleThe accessibility role. Defaults to Role::Generic.
label: Option<String>A human-readable label for assistive technology (e.g., “Close” for a button).
value: Option<String>The current value as a string (e.g., the text in an input field).
actions: ActionSetThe set of actions this node responds to.
focusable: boolWhether this node can receive keyboard focus.
multiline: boolWhether this text input supports multiple lines.
masked: boolWhether the value should be obscured (password fields).
input_mask: Option<InputMask>An optional input mask that restricts which characters are accepted.
ime_preedit_range: Option<(usize, usize)>The byte range of IME pre-edit (composition) text, if any.
checked: Option<bool>For checkboxes and switches: Some(true) = checked, Some(false) = unchecked,
None = not a toggle.
disabled: boolWhether the node is disabled (grayed out, non-interactive).
draggable: boolWhether this node can be dragged.
scrollable_x: boolWhether the node scrolls horizontally.
scrollable_y: boolWhether the node scrolls vertically.
min_value: Option<f32>Minimum value for range inputs (sliders).
max_value: Option<f32>Maximum value for range inputs (sliders).
current_value: Option<f32>Current numeric value for range inputs (sliders).
is_focus_scope: boolWhen true, this node creates a new focus scope (like a dialog or panel).
is_focus_barrier: boolWhen true, Tab traversal does not leave this subtree.
drag_payload: Option<Vec<u8>>Serialized payload attached to a drag operation.
hero_tag: Option<String>An identifier for hero/shared-element transitions.
focus_index: Option<i32>Explicit tab order index. Lower values receive focus first. None means
the node follows document order.
capture_tab: boolWhen true, Tab key inserts spaces instead of moving focus.
auto_indent: boolWhen true, Enter copies leading whitespace from the current line.