From de80f503e4db282a7343aa16d2803967d4179739 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Luk=C3=A1=C5=A1=20Tyrychtr?= Date: Thu, 23 Feb 2023 14:22:20 +0100 Subject: [PATCH] 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. --- gtk/a11y/gtkatspiutils.c | 2 ++ gtk/gtkenums.h | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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; /** -- 2.30.2