class EE::UI::AccessibilityWidgetResolver¶
Overview¶
Resolves standard widget semantics directly from the live widget instance. More…
#include <accessibilitywidgetresolver.hpp> class AccessibilityWidgetResolver { public: // methods static AccessibilityRole getRole(const UIWidget* widget); static Uint8 getHeadingLevel(const UIWidget* widget); static void onHTMLTextChanged(UIWidget* widget, std::optional<AccessibilityRole> previousRole = std::nullopt); static const char* getRoleName(AccessibilityRole role); static bool isLeafRole(AccessibilityRole role); static UIWidget* getLeafOwner(const Scene::Node* node); static bool isHiddenFromAccessibility(const UIWidget* widget); static String getName(const UIWidget* widget); static String getDescription(const UIWidget* widget); static String getValue(const UIWidget* widget); static AccessibilityShortcut getShortcut(const UIWidget* widget); static AccessibilityRangeInfo getRange(const UIWidget* widget); static AccessibilityTextInfo getText(const UIWidget* widget); static AccessibilityTextInfo getText(const UIWidget* widget, bool includeOffsets); static const Doc::TextDocument* getTextDocument(const UIWidget* widget); static Int32 getTextLength(const UIWidget* widget); static String getTextRange(const UIWidget* widget, Int32 start, Int32 end); static bool getTextLineBounds(const UIWidget* widget, Int32 offset, Int32& start, Int32& end); static AccessibilityTextRevision getTextRevision(const UIWidget* widget); static Int32 getTextOffset(const Doc::TextDocument& document, const Doc::TextPosition& position); static AccessibilityState getState(const UIWidget* widget); static AccessibilityActions getActions(const UIWidget* widget); static UIWidget* getOwningModelView(const Scene::Node* node); static UIWidget* getFocusOwner(Scene::Node* focused, const UIWidget* sceneRoot); static UIWidget* getEventTarget(UIWidget* widget, AccessibilityEvent event); static bool performAction(UIWidget* widget, const AccessibilityActionRequest& request); static std::vector<AccessibilityIssue> audit(const UIWidget* root); };
Detailed Documentation¶
Resolves standard widget semantics directly from the live widget instance.
Methods¶
static void onHTMLTextChanged(UIWidget* widget, std::optional<AccessibilityRole> previousRole = std::nullopt)
Updates queried HTML text and named ancestors. Called only after the activity gate.
static const char* getRoleName(AccessibilityRole role)
A readable role name for tools and logs, for example “CheckBox”.
static bool isLeafRole(AccessibilityRole role)
Controls whose content is fully described by their own name, value and state. Their implementation children (a button’s text view, a menu item’s shortcut label) are not exposed.
static UIWidget* getLeafOwner(const Scene::Node* node)
The outermost leaf control containing the node, or nullptr when no ancestor is a leaf.
static bool isHiddenFromAccessibility(const UIWidget* widget)
Whether the widget or any ancestor is hidden from accessibility (aria-hidden).
static AccessibilityShortcut getShortcut(const UIWidget* widget)
The keyboard shortcut of a menu item; empty for every other widget.
static AccessibilityTextInfo getText(const UIWidget* widget, bool includeOffsets)
Metadata-only queries avoid scanning document lines to calculate offsets.
static const Doc::TextDocument* getTextDocument(const UIWidget* widget)
The document behind a text element; nullptr for other widgets and for password inputs, whose text is never exposed.
static Int32 getTextLength(const UIWidget* widget)
Ranged text access, in code points. None of these copy more than the requested range.
static bool getTextLineBounds(const UIWidget* widget, Int32 offset, Int32& start, Int32& end)
The line containing offset : [start, end), end past its newline.
static Int32 getTextOffset(const Doc::TextDocument& document, const Doc::TextPosition& position)
Standalone code-point offset calculation, without retaining a document cache (O(lines)). Native widget queries use their manager’s optional incremental index instead.
static UIWidget* getOwningModelView(const Scene::Node* node)
Returns the model view whose virtual nodes represent this widget, or nullptr when the widget is exposed directly: outside every model view, or inside its active cell editor.
static UIWidget* getFocusOwner(Scene::Node* focused, const UIWidget* sceneRoot)
Projects the keyboard focus node onto the accessibility element that exposes it. Hidden implementation children (for example a spin box’s input) resolve to their semantic owner.
static UIWidget* getEventTarget(UIWidget* widget, AccessibilityEvent event)
Routes internal control state changes to their semantic owner.
static std::vector<AccessibilityIssue> audit(const UIWidget* root)
Lists common authoring problems in a widget tree: controls without an accessible name and aria-labelledby / aria-describedby ids that resolve to nothing. Hidden and invisible subtrees are skipped, as are the implementation children of model views.