a11y: Introduce a dedicated role for toggle buttons
authorLukáš Tyrychtr <ltyrycht@redhat.com>
Thu, 23 Feb 2023 13:22:20 +0000 (14:22 +0100)
committerLukáš Tyrychtr <ltyrycht@redhat.com>
Thu, 23 Feb 2023 13:22:20 +0000 (14:22 +0100)
Up until now, toggle buttons were presented as regular push buttons.
That's the approach used by the ARIA specification, however, our platform
accessibility backend, at-spi2, can not represent accessibe states with values,
so we can not represent the design pattern precisely enough for screen readers.
If, in future, the a11y backends gain this capability, we might consider again
removing this role.

gtk/a11y/gtkatspiutils.c
gtk/gtkenums.h

index a39314a7e8e5b49d91294ebfb4c4e25cb5528827..e8ed02ef319946b21ec08c028a7d7e0e2eca426b 100644 (file)
@@ -273,6 +273,8 @@ gtk_accessible_role_to_atspi_role (GtkAccessibleRole role)
     case GTK_ACCESSIBLE_ROLE_WINDOW:
       return ATSPI_ROLE_FRAME;
 
+    case GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON:
+      return ATSPI_ROLE_TOGGLE_BUTTON;
     default:
       break;
     }
index 89d8f5e4a0d3904611dc8932a93037f21ace33be..679c75e44785f5ebd742043f2b09aa1fde6ad6dc 100644 (file)
@@ -1306,6 +1306,9 @@ typedef enum {
  * @GTK_ACCESSIBLE_ROLE_WIDGET: An interactive component of a graphical user
  *    interface. This is the role that GTK uses by default for widgets.
  * @GTK_ACCESSIBLE_ROLE_WINDOW: An application window.
+ * @GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON: A type of push button
+ *    which stays pressed until depressed by a second activation.
+ *    Since: 4.10
  *
  * The accessible role for a [iface@Accessible] implementation.
  *
@@ -1390,7 +1393,8 @@ typedef enum {
   GTK_ACCESSIBLE_ROLE_TREE_GRID,
   GTK_ACCESSIBLE_ROLE_TREE_ITEM,
   GTK_ACCESSIBLE_ROLE_WIDGET,
-  GTK_ACCESSIBLE_ROLE_WINDOW
+  GTK_ACCESSIBLE_ROLE_WINDOW,
+  GTK_ACCESSIBLE_ROLE_TOGGLE_BUTTON
 } GtkAccessibleRole;
 
 /**