Skip to content

Map missing GTK/Electron/browser AT-SPI roles (switch, toggle button, spin button, heading, table) in GuiBackend #39

Backlog

Description

@m3lonxd

Context / Motivation

GuiBackend._ROLE_MAP currently maps 29 AT-SPI role strings and falls back to Role.UNKNOWN for everything else. Several standard AT-SPI roles emitted by GTK3/GTK4, Qt, Electron/Chromium, and Firefox/Zen (switch, toggle button, spin button, heading, alert, progress bar, status bar, scroll pane, table, table row, tree table, document web, document frame) are missing.

Because Element.is_wrapper() treats unnamed Role.UNKNOWN nodes with only click/focus actions as layout wrappers, unlabeled switches or toggle buttons can be silently collapsed and omitted from tree() and snapshot.actionable(). Even named controls render as [unknown], breaking --role filtering in click-text. By contrast, the macOS (ax.py) and Windows (uia.py) backends already map switches, toggles, spinners/incrementors, headings, and tables to normalized Role values.

Relevant Code

  • core/computer_use_linux/backends/gui.py:22-36 (_ROLE_MAP), 48-53 (_INTERACTIVE, _VOLATILE), 469-473 (GuiBackend._role)
  • core/computer_use_linux/models.py:14-37 (Role), 100-105 (Element.is_wrapper), 121-147 (Element._lines)
  • core/computer_use_linux/snapshot.py:39-43 (INTERACTIVE, VOLATILE_NAME), 109-115 (actionable)
  • core/computer_use_linux/backends/ax.py:30-56 (_ROLE_MAP, _SUBROLE_MAP) and core/computer_use_linux/backends/uia.py:43-55 (_ROLE_MAP) for cross-platform role alignment

Acceptance Criteria

  • Map common AT-SPI roles in GuiBackend._ROLE_MAP consistently with ax.py and uia.py (e.g. switch / toggle button -> Role.CHECKBOX, spin button / progress bar -> Role.SLIDER, heading -> Role.TEXT, alert -> Role.DIALOG, table / tree table / table row -> Role.LIST / Role.TREE / Role.LIST_ITEM, scroll pane / document web / document frame / status bar -> Role.PANEL).
  • Verify unlabeled switch and toggle button controls are preserved by GuiBackend._keep(), Element.render(), and snapshot.actionable() rather than collapsed by Element.is_wrapper(), and that spin button values remain captured in light reads (_VOLATILE).
  • Add an offline unit test suite (mocking AT-SPI nodes without requiring a live bus) covering role normalization and wrapper preservation, and register it in .github/workflows/ci.yml.

Getting Started / How to Verify

env -u DISPLAY -u WAYLAND_DISPLAY -u DBUS_SESSION_BUS_ADDRESS python3 tests/test_smoke.py
env -u DISPLAY -u WAYLAND_DISPLAY -u DBUS_SESSION_BUS_ADDRESS python3 tests/test_snapshot.py

Activity

  1. added
    accessibility
    enhancement
    help wanted
    on Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityenhancementhelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions