From 800eb76a2de85b4e1844b28b50d440602bf9c4f8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 21 Oct 2020 21:54:17 -0400 Subject: [PATCH] linkbutton: Use the LINK role It is a bit ambiguous, but I think link buttons are more links than buttons. See WAI-ARIA for a discussion of the differences. Update tests to match. --- docs/reference/gtk/section-accessibility.md | 1 + gtk/gtkenums.h | 2 +- gtk/gtklinkbutton.c | 4 ++-- testsuite/a11y/button.c | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/reference/gtk/section-accessibility.md b/docs/reference/gtk/section-accessibility.md index 5ba59a5a46..c86eb3c3c1 100644 --- a/docs/reference/gtk/section-accessibility.md +++ b/docs/reference/gtk/section-accessibility.md @@ -54,6 +54,7 @@ Each role name is part of the #GtkAccessibleRole enumeration. | `GRID_CELL` | An item in a grid | #GtkFlowBoxChild, #GtkGridView, #GtkColumnView | | `IMG` | An image | #GtkImage, #GtkPicture | | `LABEL` | A visible name or caption for a user interface component | #GtkLabel | +| `LINK` | A clickable hyperlink | #GtkLinkButton | | `LIST` | A list of items | #GtkListBox | | `LIST_ITEM` | An item in a list | #GtkListBoxRow | | `MENU` | A menu | #GtkPopoverMenu | diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h index 40c793a8a1..9a64124c49 100644 --- a/gtk/gtkenums.h +++ b/gtk/gtkenums.h @@ -1183,7 +1183,7 @@ typedef enum { * @GTK_ACCESSIBLE_ROLE_LABEL: A visible name or caption for a user interface component. * @GTK_ACCESSIBLE_ROLE_LANDMARK: Abstract role. * @GTK_ACCESSIBLE_ROLE_LEGEND: Unused - * @GTK_ACCESSIBLE_ROLE_LINK: Unused + * @GTK_ACCESSIBLE_ROLE_LINK: A clickable link. * @GTK_ACCESSIBLE_ROLE_LIST: A list of items. * @GTK_ACCESSIBLE_ROLE_LIST_BOX: Unused. * @GTK_ACCESSIBLE_ROLE_LIST_ITEM: An item in a list. diff --git a/gtk/gtklinkbutton.c b/gtk/gtklinkbutton.c index 53a01cc207..e3baf93bc6 100644 --- a/gtk/gtklinkbutton.c +++ b/gtk/gtklinkbutton.c @@ -50,7 +50,7 @@ * * # Accessibility * - * GtkLinkButton uses the #GTK_ACCESSIBLE_ROLE_BUTTON role. + * GtkLinkButton uses the #GTK_ACCESSIBLE_ROLE_LINK role. */ #include "config.h" @@ -220,7 +220,7 @@ gtk_link_button_class_init (GtkLinkButtonClass *klass) G_TYPE_BOOLEAN, 0); gtk_widget_class_set_css_name (widget_class, I_("button")); - gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_BUTTON); + gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_LINK); /** * GtkLinkButton|clipboard.copy: diff --git a/testsuite/a11y/button.c b/testsuite/a11y/button.c index a5e44280a4..803a2fecf8 100644 --- a/testsuite/a11y/button.c +++ b/testsuite/a11y/button.c @@ -49,7 +49,7 @@ linkbutton_role (void) GtkWidget *button = gtk_link_button_new ("Hello"); g_object_ref_sink (button); - gtk_test_accessible_assert_role (button, GTK_ACCESSIBLE_ROLE_BUTTON); + gtk_test_accessible_assert_role (button, GTK_ACCESSIBLE_ROLE_LINK); g_object_unref (button); }