Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
AccessibilityServer๏
Inherits: Object
A server interface for screen reader support.
Methods๏
Enumerations๏
enum AccessibilityRole: ๐
AccessibilityRole ROLE_UNKNOWN = 0
Unknown or custom role.
AccessibilityRole ROLE_DEFAULT_BUTTON = 1
Default dialog button element.
AccessibilityRole ROLE_AUDIO = 2
Audio player element.
AccessibilityRole ROLE_VIDEO = 3
Video player element.
AccessibilityRole ROLE_STATIC_TEXT = 4
Non-editable text label.
AccessibilityRole ROLE_CONTAINER = 5
Container element. Elements with this role are used for internal structure and ignored by screen readers.
AccessibilityRole ROLE_PANEL = 6
Panel container element.
AccessibilityRole ROLE_BUTTON = 7
Button element.
AccessibilityRole ROLE_LINK = 8
Link element.
AccessibilityRole ROLE_CHECK_BOX = 9
Check box element.
AccessibilityRole ROLE_RADIO_BUTTON = 10
Radio button element.
AccessibilityRole ROLE_CHECK_BUTTON = 11
Check button element.
AccessibilityRole ROLE_SCROLL_BAR = 12
Scroll bar element.
AccessibilityRole ROLE_SCROLL_VIEW = 13
Scroll container element.
AccessibilityRole ROLE_SPLITTER = 14
Container splitter handle element.
AccessibilityRole ROLE_SLIDER = 15
Slider element.
AccessibilityRole ROLE_SPIN_BUTTON = 16
Spin box element.
AccessibilityRole ROLE_PROGRESS_INDICATOR = 17
Progress indicator element.
AccessibilityRole ROLE_TEXT_FIELD = 18
Editable text field element.
AccessibilityRole ROLE_MULTILINE_TEXT_FIELD = 19
Multiline editable text field element.
AccessibilityRole ROLE_COLOR_PICKER = 20
Color picker element.
AccessibilityRole ROLE_TABLE = 21
Table element.
AccessibilityRole ROLE_CELL = 22
Table/tree cell element.
AccessibilityRole ROLE_ROW = 23
Table/tree row element.
AccessibilityRole ROLE_ROW_GROUP = 24
Table/tree row group element.
AccessibilityRole ROLE_ROW_HEADER = 25
Table/tree row header element.
AccessibilityRole ROLE_COLUMN_HEADER = 26
Table/tree column header element.
AccessibilityRole ROLE_TREE = 27
Tree view element.
AccessibilityRole ROLE_TREE_ITEM = 28
Tree view item element.
AccessibilityRole ROLE_LIST = 29
List element.
AccessibilityRole ROLE_LIST_ITEM = 30
List item element.
AccessibilityRole ROLE_LIST_BOX = 31
List view element.
AccessibilityRole ROLE_LIST_BOX_OPTION = 32
List view item element.
AccessibilityRole ROLE_TAB_BAR = 33
Tab bar element.
AccessibilityRole ROLE_TAB = 34
Tab bar item element.
AccessibilityRole ROLE_TAB_PANEL = 35
Tab panel element.
Menu bar element.
Popup menu element.
Popup menu item element.
Popup menu check button item element.
Popup menu radio button item element.
AccessibilityRole ROLE_IMAGE = 41
Image element.
AccessibilityRole ROLE_WINDOW = 42
Window element.
AccessibilityRole ROLE_TITLE_BAR = 43
Embedded window title bar element.
AccessibilityRole ROLE_DIALOG = 44
Dialog window element.
AccessibilityRole ROLE_TOOLTIP = 45
Tooltip element.
AccessibilityRole ROLE_REGION = 46
Region/landmark element. Screen readers can navigate between regions using landmark navigation.
AccessibilityRole ROLE_TEXT_RUN = 47
Unifor text run.
Note: This role is used for internal text elements, and should not be assigned to nodes.
enum AccessibilityPopupType: ๐
Popup menu.
AccessibilityPopupType POPUP_LIST = 1
Popup list.
AccessibilityPopupType POPUP_TREE = 2
Popup tree view.
AccessibilityPopupType POPUP_DIALOG = 3
Popup dialog.
enum AccessibilityFlags: ๐
Element is hidden for accessibility tools.
AccessibilityFlags FLAG_MULTISELECTABLE = 1
Element supports multiple item selection.
AccessibilityFlags FLAG_REQUIRED = 2
Element require user input.
AccessibilityFlags FLAG_VISITED = 3
Element is a visited link.
AccessibilityFlags FLAG_BUSY = 4
Element content is not ready (e.g. loading).
AccessibilityFlags FLAG_MODAL = 5
Element is modal window.
AccessibilityFlags FLAG_TOUCH_PASSTHROUGH = 6
Element allows touches to be passed through when a screen reader is in touch exploration mode.
AccessibilityFlags FLAG_READONLY = 7
Element is text field with selectable but read-only text.
AccessibilityFlags FLAG_DISABLED = 8
Element is disabled.
AccessibilityFlags FLAG_CLIPS_CHILDREN = 9
Element clips children.
enum AccessibilityAction: ๐
AccessibilityAction ACTION_CLICK = 0
Single click action, callback argument is not set.
AccessibilityAction ACTION_FOCUS = 1
Focus action, callback argument is not set.
AccessibilityAction ACTION_BLUR = 2
Blur action, callback argument is not set.
AccessibilityAction ACTION_COLLAPSE = 3
Collapse action, callback argument is not set.
AccessibilityAction ACTION_EXPAND = 4
Expand action, callback argument is not set.
AccessibilityAction ACTION_DECREMENT = 5
Decrement action, callback argument is not set.
AccessibilityAction ACTION_INCREMENT = 6
Increment action, callback argument is not set.
AccessibilityAction ACTION_HIDE_TOOLTIP = 7
Hide tooltip action, callback argument is not set.
AccessibilityAction ACTION_SHOW_TOOLTIP = 8
Show tooltip action, callback argument is not set.
AccessibilityAction ACTION_SET_TEXT_SELECTION = 9
Set text selection action, callback argument is set to Dictionary with the following keys:
"start_element"accessibility element of the selection start."start_char"character offset relative to the accessibility element of the selection start."end_element"accessibility element of the selection end."end_char"character offset relative to the accessibility element of the selection end.
AccessibilityAction ACTION_REPLACE_SELECTED_TEXT = 10
Replace text action, callback argument is set to String with the replacement text.
AccessibilityAction ACTION_SCROLL_BACKWARD = 11
Scroll backward action, callback argument is not set.
AccessibilityAction ACTION_SCROLL_DOWN = 12
Scroll down action, callback argument is set to AccessibilityScrollUnit.
AccessibilityAction ACTION_SCROLL_FORWARD = 13
Scroll forward action, callback argument is not set.
AccessibilityAction ACTION_SCROLL_LEFT = 14
Scroll left action, callback argument is set to AccessibilityScrollUnit.
AccessibilityAction ACTION_SCROLL_RIGHT = 15
Scroll right action, callback argument is set to AccessibilityScrollUnit.
AccessibilityAction ACTION_SCROLL_UP = 16
Scroll up action, callback argument is set to AccessibilityScrollUnit.
AccessibilityAction ACTION_SCROLL_INTO_VIEW = 17
Scroll into view action, callback argument is set to AccessibilityScrollHint.
AccessibilityAction ACTION_SCROLL_TO_POINT = 18
Scroll to point action, callback argument is set to Vector2 with the relative point coordinates.
AccessibilityAction ACTION_SET_SCROLL_OFFSET = 19
Set scroll offset action, callback argument is set to Vector2 with the scroll offset.
AccessibilityAction ACTION_SET_VALUE = 20
Set value action, callback argument is set to String or number with the new value.
Show context menu action, callback argument is not set.
AccessibilityAction ACTION_CUSTOM = 22
Custom action, callback argument is set to the integer action ID.
enum AccessibilityLiveMode: ๐
AccessibilityLiveMode LIVE_OFF = 0
Indicates that updates to the live region should not be presented.
AccessibilityLiveMode LIVE_POLITE = 1
Indicates that updates to the live region should be presented at the next opportunity (for example at the end of speaking the current sentence).
AccessibilityLiveMode LIVE_ASSERTIVE = 2
Indicates that updates to the live region have the highest priority and should be presented immediately.
enum AccessibilityScrollUnit: ๐
AccessibilityScrollUnit SCROLL_UNIT_ITEM = 0
The amount by which to scroll. A single item of a list, line of text.
AccessibilityScrollUnit SCROLL_UNIT_PAGE = 1
The amount by which to scroll. A single page.
enum AccessibilityScrollHint: ๐
AccessibilityScrollHint SCROLL_HINT_TOP_LEFT = 0
A preferred position for the node scrolled into view. Top-left edge of the scroll container.
AccessibilityScrollHint SCROLL_HINT_BOTTOM_RIGHT = 1
A preferred position for the node scrolled into view. Bottom-right edge of the scroll container.
AccessibilityScrollHint SCROLL_HINT_TOP_EDGE = 2
A preferred position for the node scrolled into view. Top edge of the scroll container.
AccessibilityScrollHint SCROLL_HINT_BOTTOM_EDGE = 3
A preferred position for the node scrolled into view. Bottom edge of the scroll container.
AccessibilityScrollHint SCROLL_HINT_LEFT_EDGE = 4
A preferred position for the node scrolled into view. Left edge of the scroll container.
AccessibilityScrollHint SCROLL_HINT_RIGHT_EDGE = 5
A preferred position for the node scrolled into view. Right edge of the scroll container.
Method Descriptions๏
RID create_element(window_id: int, role: AccessibilityRole) ๐
Creates a new, empty accessibility element resource.
Note: An accessibility element is created and freed automatically for each Node. In general, this function should not be called manually.
RID create_sub_element(parent_rid: RID, role: AccessibilityRole, insert_pos: int = -1) ๐
Creates a new, empty accessibility sub-element resource. Sub-elements can be used to provide accessibility information for objects which are not Nodes, such as list items, table cells, or menu items. Sub-elements are freed automatically when the parent element is freed, or can be freed early using the free_element() method.
RID create_sub_text_edit_elements(parent_rid: RID, shaped_text: RID, min_height: float, insert_pos: int = -1, is_last_line: bool = false) ๐
Creates a new, empty accessibility sub-element from the shaped text buffer. Sub-elements are freed automatically when the parent element is freed, or can be freed early using the free_element() method.
If is_last_line is true, no trailing newline is appended to the text content. Set to true for the last line in multi-line text fields and for single-line text fields.
Variant element_get_meta(id: RID) const ๐
Returns the metadata of the accessibility element id.
void element_set_meta(id: RID, meta: Variant) ๐
Sets the metadata of the accessibility element id to meta.
void free_element(id: RID) ๐
Frees the accessibility element id created by create_element(), create_sub_element(), or create_sub_text_edit_elements().
RID get_window_root(window_id: int) const ๐
Returns the main accessibility element of the OS native window.
bool has_element(id: RID) const ๐
Returns true if id is a valid accessibility element.
bool is_supported() const ๐
Returns true if screen reader is support by this implementation.
void set_window_focused(window_id: int, focused: bool) ๐
Sets the window focused state for assistive apps.
Note: This method is implemented on Linux, macOS, and Windows.
Note: Advanced users only! Window objects call this method automatically.
void set_window_rect(window_id: int, rect_out: Rect2, rect_in: Rect2) ๐
Sets window outer (with decorations) and inner (without decorations) bounds for assistive apps.
Note: This method is implemented on Linux, macOS, and Windows.
Note: Advanced users only! Window objects call this method automatically.
void update_add_action(id: RID, action: AccessibilityAction, callable: Callable) ๐
Adds a callback for the accessibility action (action which can be performed by using a special screen reader command or buttons on the Braille display), and marks this action as supported. The action callback receives one Variant argument, which value depends on action type.
void update_add_child(id: RID, child_id: RID) ๐
Adds a child accessibility element.
Note: Node children and sub-elements are added to the child list automatically.
void update_add_custom_action(id: RID, action_id: int, action_description: String) ๐
Adds support for a custom accessibility action. action_id is passed as an argument to the callback of ACTION_CUSTOM action.
Adds an element that is controlled by this element.
Adds an element that describes this element.
Adds an element that details this element.
Adds an element that this element flow into.
Adds an element that labels this element.
Adds an element that is part of the same radio group.
Note: This method should be called on each element of the group, using all other elements as related_id.
void update_set_active_descendant(id: RID, other_id: RID) ๐
Adds an element that is an active descendant of this element.
void update_set_background_color(id: RID, color: Color) ๐
Sets element background color.
void update_set_bounds(id: RID, p_rect: Rect2) ๐
Sets element bounding box, relative to the node position.
void update_set_braille_label(id: RID, name: String) ๐
Sets element accessibility label for Braille display.
void update_set_braille_role_description(id: RID, description: String) ๐
Sets element accessibility role description for Braille display.
void update_set_checked(id: RID, checekd: bool) ๐
Sets element checked state.
void update_set_classname(id: RID, classname: String) ๐
Sets element class name.
void update_set_color_value(id: RID, color: Color) ๐
Sets element color value.
void update_set_description(id: RID, description: String) ๐
Sets element accessibility description.
void update_set_error_message(id: RID, other_id: RID) ๐
Sets an element which contains an error message for this element.
void update_set_extra_info(id: RID, name: String) ๐
Sets element accessibility extra information added to the element name.
void update_set_flag(id: RID, flag: AccessibilityFlags, value: bool) ๐
Sets element flag.
void update_set_focus(id: RID) ๐
Sets currently focused element.
void update_set_foreground_color(id: RID, color: Color) ๐
Sets element foreground color.
void update_set_in_page_link_target(id: RID, other_id: RID) ๐
Sets target element for the link.
void update_set_language(id: RID, language: String) ๐
Sets element text language.
void update_set_list_item_count(id: RID, size: int) ๐
Sets number of items in the list.
void update_set_list_item_expanded(id: RID, expanded: bool) ๐
Sets list/tree item expanded status.
void update_set_list_item_index(id: RID, index: int) ๐
Sets the position of the element in the list.
void update_set_list_item_level(id: RID, level: int) ๐
Sets the hierarchical level of the element in the list.
void update_set_list_item_selected(id: RID, selected: bool) ๐
Sets list/tree item selected status.
void update_set_list_orientation(id: RID, vertical: bool) ๐
Sets the orientation of the list elements.
void update_set_live(id: RID, live: AccessibilityLiveMode) ๐
Sets the priority of the live region updates.
void update_set_member_of(id: RID, group_id: RID) ๐
Sets the element to be a member of the group.
void update_set_name(id: RID, name: String) ๐
Sets element accessibility name.
void update_set_next_on_line(id: RID, other_id: RID) ๐
Sets next element on the line.
void update_set_num_jump(id: RID, jump: float) ๐
Sets numeric value jump.
void update_set_num_range(id: RID, min: float, max: float) ๐
Sets numeric value range.
void update_set_num_step(id: RID, step: float) ๐
Sets numeric value step.
void update_set_num_value(id: RID, position: float) ๐
Sets numeric value.
void update_set_placeholder(id: RID, placeholder: String) ๐
Sets placeholder text.
void update_set_popup_type(id: RID, popup: AccessibilityPopupType) ๐
Sets popup type for popup buttons.
void update_set_previous_on_line(id: RID, other_id: RID) ๐
Sets previous element on the line.
void update_set_role(id: RID, role: AccessibilityRole) ๐
Sets element accessibility role.
void update_set_role_description(id: RID, description: String) ๐
Sets element accessibility role description text.
void update_set_scroll_x(id: RID, position: float) ๐
Sets scroll bar x position.
void update_set_scroll_x_range(id: RID, min: float, max: float) ๐
Sets scroll bar x range.
void update_set_scroll_y(id: RID, position: float) ๐
Sets scroll bar y position.
void update_set_scroll_y_range(id: RID, min: float, max: float) ๐
Sets scroll bar y range.
void update_set_shortcut(id: RID, shortcut: String) ๐
Sets the list of keyboard shortcuts used by element.
void update_set_state_description(id: RID, description: String) ๐
Sets human-readable description of the current checked state.
void update_set_table_cell_position(id: RID, row_index: int, column_index: int) ๐
Sets cell position in the table.
void update_set_table_cell_span(id: RID, row_span: int, column_span: int) ๐
Sets cell row/column span.
void update_set_table_column_count(id: RID, count: int) ๐
Sets number of columns in the table.
void update_set_table_column_index(id: RID, index: int) ๐
Sets position of the column.
void update_set_table_row_count(id: RID, count: int) ๐
Sets number of rows in the table.
void update_set_table_row_index(id: RID, index: int) ๐
Sets position of the row in the table.
void update_set_text_align(id: RID, align: HorizontalAlignment) ๐
Sets element text alignment.
void update_set_text_decorations(id: RID, underline: bool, strikethrough: bool, overline: bool, color: Color = Color(0, 0, 0, 1)) ๐
Sets text underline/overline/strikethrough.
void update_set_text_orientation(id: RID, vertical: bool) ๐
Sets text orientation.
void update_set_text_selection(id: RID, text_start_id: RID, start_char: int, text_end_id: RID, end_char: int) ๐
Sets text selection to the text field. text_start_id and text_end_id should be elements created by create_sub_text_edit_elements(). Character offsets are relative to the corresponding element.
void update_set_tooltip(id: RID, tooltip: String) ๐
Sets tooltip text.
void update_set_transform(id: RID, transform: Transform2D) ๐
Sets element 2D transform.
void update_set_url(id: RID, url: String) ๐
Sets link URL.
void update_set_value(id: RID, value: String) ๐
Sets element text value.