From: Lukáš Tyrychtr Date: Thu, 23 Feb 2023 13:22:20 +0000 (+0100) Subject: a11y: Introduce a dedicated role for toggle buttons X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~22^2~6^2~38^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=de80f503e4db282a7343aa16d2803967d4179739;p=gtk4.git 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. --- diff --git a/gtk/a11y/gtkatspiutils.c b/gtk/a11y/gtkatspiutils.c index a39314a7e8..e8ed02ef31 100644 --- a/gtk/a11y/gtkatspiutils.c +++ b/gtk/a11y/gtkatspiutils.c @@ -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; } diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index 89d8f5e4a0..679c75e447 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -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; /**