README

mizchi/crater-dom/aom does not have a README file

#
AccessibilityNode

pub(all) struct AccessibilityNode {
id : String
role : Role
name : String?
description : String?
level : Int?
states : Array[State]
properties : Map[String, String]
bounds : Bounds?
children : Array[AccessibilityNode]
focusable : Bool
tabindex : Int?
source_id : String?
href : String?
tag_name : String?
selector : String?
visible : Bool
ref_id : String?
input_type : String?
placeholder : String?
input_value : String?
required : Bool
text : String?
options : Array[SelectOption]
labelled_by : String?
}

Core accessibility node in the AOM tree

#
AccessibilityNode::add_child

#
AccessibilityNode::add_state

#
AccessibilityNode::new

fn AccessibilityNode::new(id : String, role : Role) -> AccessibilityNode

#
AccessibilityNode::set_focusable

fn AccessibilityNode::set_focusable(self : AccessibilityNode, focusable : Bool) -> AccessibilityNode

#
AccessibilityNode::to_aria_json

fn AccessibilityNode::to_aria_json(self : AccessibilityNode) -> String

Generate an ARIA snapshot in JSON format for a single node

#
AccessibilityNode::to_aria_snapshot

fn AccessibilityNode::to_aria_snapshot(self : AccessibilityNode) -> String

Generate an ARIA snapshot for a single node

#
AccessibilityNode::with_bounds

fn AccessibilityNode::with_bounds(self : AccessibilityNode, bounds : Bounds) -> AccessibilityNode

#
AccessibilityNode::with_level

fn AccessibilityNode::with_level(self : AccessibilityNode, level : Int) -> AccessibilityNode

#
AccessibilityNode::with_name

fn AccessibilityNode::with_name(self : AccessibilityNode, name : String) -> AccessibilityNode

#
AccessibilityNode::with_tabindex

fn AccessibilityNode::with_tabindex(self : AccessibilityNode, tabindex : Int) -> AccessibilityNode

#
AccessibilityTree

pub(all) struct AccessibilityTree {
root : AccessibilityNode
node_map : Map[String, AccessibilityNode]
}

The complete accessibility tree

#
AccessibilityTree::find_by_id

fn AccessibilityTree::find_by_id(self : AccessibilityTree, id : String) -> AccessibilityNode?

#
AccessibilityTree::find_by_role

fn AccessibilityTree::find_by_role(self : AccessibilityTree, role : Role) -> Array[AccessibilityNode]

#
AccessibilityTree::find_by_source_id

fn AccessibilityTree::find_by_source_id(self : AccessibilityTree, source_id : String) -> AccessibilityNode?

Find node by its source element id

#
AccessibilityTree::find_focusable

#
AccessibilityTree::new

#
AccessibilityTree::to_aria_json

fn AccessibilityTree::to_aria_json(self : AccessibilityTree) -> String

Generate an ARIA snapshot in JSON format from an AccessibilityTree

#
AccessibilityTree::to_aria_snapshot

fn AccessibilityTree::to_aria_snapshot(self : AccessibilityTree) -> String

Generate an ARIA snapshot in YAML format from an AccessibilityTree

#
Bounds

pub(all) struct Bounds {
x : Double
y : Double
width : Double
height : Double
}

Bounding rectangle for spatial information

#
Bounds::default

fn Bounds::default() -> Bounds

#
Bounds::new

fn Bounds::new(x : Double, y : Double, width : Double, height : Double) -> Bounds

#
FocusManager

pub(all) struct FocusManager {
tree : AccessibilityTree
tab_order : Array[FocusableItem]
current_index : Int
}

Focus manager for handling Tab/Shift+Tab navigation

#
FocusManager::blur

fn FocusManager::blur(self : FocusManager) -> Unit

Clear focus

#
FocusManager::current

Get the currently focused node, if any

#
FocusManager::current_id

fn FocusManager::current_id(self : FocusManager) -> String?

Get the currently focused node id, if any

#
FocusManager::focus_by_id

fn FocusManager::focus_by_id(self : FocusManager, id : String) -> Bool

Focus a specific node by id Returns true if focus was set, false if node not found or not focusable

#
FocusManager::focus_by_source_id

fn FocusManager::focus_by_source_id(self : FocusManager, source_id : String) -> Bool

Focus a specific node by source element id Returns true if focus was set, false if not found

#
FocusManager::focus_first

fn FocusManager::focus_first(self : FocusManager) -> AccessibilityNode?

Reset focus to the first focusable element Returns the focused node, or None if no focusable elements

#
FocusManager::focus_last

fn FocusManager::focus_last(self : FocusManager) -> AccessibilityNode?

Focus the last focusable element Returns the focused node, or None if no focusable elements

#
FocusManager::focus_next

fn FocusManager::focus_next(self : FocusManager) -> AccessibilityNode?

Move focus to the next focusable element (Tab) Returns the newly focused node, or None if no focusable elements

#
FocusManager::focus_prev

fn FocusManager::focus_prev(self : FocusManager) -> AccessibilityNode?

Move focus to the previous focusable element (Shift+Tab) Returns the newly focused node, or None if no focusable elements

#
FocusManager::focusable_count

fn FocusManager::focusable_count(self : FocusManager) -> Int

Get the number of focusable elements

#
FocusManager::get_tab_order

fn FocusManager::get_tab_order(self : FocusManager) -> Array[FocusableItem]

Get all focusable items in tab order

#
FocusManager::has_focus

fn FocusManager::has_focus(self : FocusManager) -> Bool

Check if there is currently a focused element

#
FocusManager::new

Create a new FocusManager for an accessibility tree

#
FocusableItem

pub(all) struct FocusableItem {
node : AccessibilityNode
document_order : Int
effective_tabindex : Int
}

Represents a focusable item in the tab order

#
Role

pub(all) enum Role {
Article
Blockquote
Caption
Cell
Code
ColumnHeader
Definition
Deletion
Directory
Document
Emphasis
Feed
Figure
Generic
Group
Heading
Img
Insertion
List
ListItem
Mark
Math
Meter
None
Note
Paragraph
Presentation
Row
RowGroup
RowHeader
Separator
Strong
Subscript
Superscript
Table
Term
Time
Toolbar
Tooltip
Button
Checkbox
Combobox
GridCell
Link
Listbox
Menu
MenuBar
MenuItem
MenuItemCheckbox
MenuItemRadio
Option
Progressbar
Radio
RadioGroup
Scrollbar
SearchBox
Slider
SpinButton
Switch
Tab
TabList
TabPanel
Textbox
Tree
TreeGrid
TreeItem
Application
Banner
Complementary
ContentInfo
Form
Main
Navigation
Region
Search
Alert
AlertDialog
Dialog
Log
Marquee
Status
Timer
Window
HtmlAudio
HtmlVideo
HtmlCanvas
HtmlLabel
HtmlSummary
} derive(Eq,
Debug
)

ARIA Role categories based on WAI-ARIA specification
impl Show for Role

#
Role::from_string

fn Role::from_string(s : String) -> Role?

#
Role::to_string

fn Role::to_string(self : Role) -> String

#
RoleMappingContext

pub(all) struct RoleMappingContext {
parent_tag : String?
has_accessible_name : Bool
in_sectioning_content : Bool
}

Context for determining contextual roles

#
RoleMappingContext::default

#
SelectOption

pub(all) struct SelectOption {
value : String
label : String
selected : Bool
}

Option for select elements

#
State

pub(all) enum State {
Busy
Checked
Disabled
Expanded
Grabbed
Hidden
Invalid
Pressed
Selected
CheckedMixed
PressedMixed
} derive(Eq,
Debug
)

ARIA state values
impl Show for State

#
State::to_string

fn State::to_string(self : State) -> String

#
attach_bounds

fn attach_bounds(tree : AccessibilityTree, bounds_map : Map[String, Bounds]) -> AccessibilityTree

Attach layout bounds to accessibility nodes Takes a mapping from element id to bounds

#
build_accessibility_tree

fn build_accessibility_tree(doc :
Document
) -> AccessibilityTree

Build an AccessibilityTree from an HTML Document

#
build_accessibility_tree_from_element

fn build_accessibility_tree_from_element(element :
Element
) -> AccessibilityTree

Build an AccessibilityTree from a single HTML Element

#
build_accessibility_tree_lightweight

fn build_accessibility_tree_lightweight(doc :
Document
) -> AccessibilityTree

Build lightweight accessibility tree (no CSS, no layout, no bounds) This is much faster and uses less memory for large HTML files.

#
build_accessibility_tree_with_node_layout

fn build_accessibility_tree_with_node_layout(doc :
Document
, layout :
Layout
) -> AccessibilityTree

Build AccessibilityTree from HTML and attach layout bounds from @layout_types.Layout This is the integration function for combining a11y with renderer's layout

#
compute_accessible_description

fn compute_accessible_description(element :
Element
, find_by_id : (String) ->
Element
?) -> String?

Compute the accessible description for an HTML element

#
compute_accessible_description_with_label

fn compute_accessible_description_with_label(element :
Element
, find_by_id : (String) ->
Element
?, find_label_for_id : (String) ->
Element
?) -> String?

Compute the accessible description with label lookup support

#
compute_accessible_name

fn compute_accessible_name(element :
Element
, find_by_id : (String) ->
Element
?) -> String?

Compute the accessible name for an HTML element Follows the accname-1.2 algorithm

#
compute_accessible_name_full

fn compute_accessible_name_full(element :
Element
, find_by_id : (String) ->
Element
?, find_label_for_id : (String) ->
Element
?, encapsulating_label :
Element
?) -> String?

Compute the accessible name with full label support (including encapsulation)

#
compute_accessible_name_with_label

fn compute_accessible_name_with_label(element :
Element
, find_by_id : (String) ->
Element
?, find_label_for_id : (String) ->
Element
?) -> String?

Compute the accessible name with label lookup support

#
compute_role

fn compute_role(element :
Element
, context : RoleMappingContext) -> Role

Get the computed role for an HTML element Follows HTML-AAM specification for role mapping

#
compute_tab_order

fn compute_tab_order(tree : AccessibilityTree) -> Array[FocusableItem]

Compute the tab order for an accessibility tree Returns focusable items sorted by tab order:
  1. Elements with tabindex > 0, sorted by tabindex value (ascending)
  2. Elements with tabindex = 0 or implicit focusable, in document order
  3. Elements with tabindex < 0 are excluded (not tabbable)
  4. Elements with zero-size or missing bounds are excluded

#
extract_bounds_from_node_layout

fn extract_bounds_from_node_layout(layout :
Layout
) -> Map[String, Bounds]

Extract bounds from @layout_types.Layout (renderer's layout result) This extracts proper bounds after CSS has been applied

#
find_headings

fn find_headings(tree : AccessibilityTree) -> Array[AccessibilityNode]

Find all headings in the tree (returns in document order)

#
find_interactive

fn find_interactive(tree : AccessibilityTree) -> Array[AccessibilityNode]

Find all interactive elements in the tree

#
find_landmarks

fn find_landmarks(tree : AccessibilityTree) -> Array[AccessibilityNode]

Find all landmarks in the tree

#
get_heading_level

fn get_heading_level(element :
Element
) -> Int?

Get heading level from tag name or aria-level

#
get_tab_order_ids

fn get_tab_order_ids(tree : AccessibilityTree) -> Array[String]

Get tab order node IDs as a simple array of strings Useful for debugging and testing

#
get_tab_order_info

fn get_tab_order_info(tree : AccessibilityTree) -> Array[(String, String?, Role)]

Get tab order with names for debugging

#
is_sectioning_content

fn is_sectioning_content(tag : String) -> Bool

Check if element is sectioning content (affects header/footer role)

#
role_is_inherently_focusable

fn role_is_inherently_focusable(role : Role) -> Bool

Check if a role is inherently focusable

#
role_is_landmark

fn role_is_landmark(role : Role) -> Bool

Check if a role is a landmark role

#
role_supports_name_from_content

fn role_supports_name_from_content(role : Role) -> Bool

Check if a role supports accessible name from contents

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io