a11y: Introduce a dedicated role for toggle buttons

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.
This commit is contained in:
Lukáš Tyrychtr 2023-02-23 14:22:20 +01:00
parent 41b67c4722
commit de80f503e4
2 changed files with 7 additions and 1 deletions

View 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;
}

View 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;
/**