Merge branch 'more-a11y-fixes' into 'main'

widget: Don't let abstract role slip through

See merge request GNOME/gtk!6135
This commit is contained in:
Matthias Clasen
2023-06-22 00:47:03 +00:00
6 changed files with 35 additions and 1 deletions

View File

@@ -280,6 +280,7 @@ gtk_color_dialog_button_class_init (GtkColorDialogButtonClass *class)
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "colorbutton");
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
}
/* }}} */

View File

@@ -4573,7 +4573,7 @@ gtk_file_chooser_widget_unselect_all (GtkFileChooser *chooser)
/* Checks whether the filename entry for Save modes contains a well-formed filename.
*
* is_well_formed_ret - whether what the user typed passes gkt_file_system_make_path()
* is_well_formed_ret - whether what the user typed passes gtk_file_system_make_path()
*
* is_empty_ret - whether the file entry is totally empty
*

View File

@@ -385,6 +385,7 @@ gtk_font_dialog_button_class_init (GtkFontDialogButtonClass *class)
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
gtk_widget_class_set_css_name (widget_class, "fontbutton");
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_GROUP);
}
/* }}} */

View File

@@ -2401,6 +2401,8 @@ gtk_widget_root_at_context (GtkWidget *self)
/* Reset the accessible role to its current value */
if (role == GTK_ACCESSIBLE_ROLE_WIDGET)
role = GTK_WIDGET_GET_CLASS (self)->priv->accessible_role;
if (role == GTK_ACCESSIBLE_ROLE_WIDGET)
role = GTK_ACCESSIBLE_ROLE_GENERIC;
gtk_at_context_set_accessible_role (priv->at_context, role);
if (priv->root)

View File

@@ -0,0 +1,29 @@
#include <gtk/gtk.h>
static void
color_dialog_button_role (void)
{
GtkWidget *window, *widget;
widget = gtk_color_dialog_button_new (NULL);
window = gtk_window_new ();
gtk_window_set_child (GTK_WINDOW (window), widget);
gtk_window_present (GTK_WINDOW (window));
while (!gtk_widget_get_realized (widget))
g_main_context_iteration (NULL, FALSE);
gtk_test_accessible_assert_role (widget, GTK_ACCESSIBLE_ROLE_GROUP);
gtk_window_destroy (GTK_WINDOW (window));
}
int
main (int argc, char *argv[])
{
gtk_test_init (&argc, &argv, NULL);
g_test_add_func ("/a11y/color-dialog-button/role", color_dialog_button_role);
return g_test_run ();
}

View File

@@ -11,6 +11,7 @@ tests = [
{ 'name': 'box' },
{ 'name': 'button' },
{ 'name': 'checkbutton' },
{ 'name': 'colordialogbutton' },
{ 'name': 'custom' },
{ 'name': 'dialog' },
{ 'name': 'entry' },