window: Use application as accessible role

ARIA deems the window role to be abstract,
so lets use the application role instead.

Update affected tests.
This commit is contained in:
Matthias Clasen 2023-06-16 19:03:49 -04:00
parent 85c2d5f14e
commit c2d6f900d9
4 changed files with 8 additions and 6 deletions

View File

@ -46,6 +46,7 @@ Each role name is part of the #GtkAccessibleRole enumeration.
| Role name | Description | Related GTK widget |
|-----------|-------------|--------------------|
| `APPLICATION` | An application window | [class@Gtk.Window] |
| `BUTTON` | A control that performs an action when pressed | [class@Gtk.Button], [class@Gtk.LinkButton], [class@Gtk.Expander] |
| `CHECKBOX` | A control that has three possible value: `true`, `false`, or `undefined` | [class@Gtk.CheckButton] |
| `COMBOBOX` | A control that can be expanded to show a list of possible values to select | [class@Gtk.ComboBox] |
@ -78,7 +79,6 @@ Each role name is part of the #GtkAccessibleRole enumeration.
| `TAB_PANEL` | A page in a notebook or stack | [class@Gtk.Stack] |
| `TEXT_BOX` | A type of input that allows free-form text as its value. | [class@Gtk.Entry], [class@Gtk.PasswordEntry], [class@Gtk.TextView] |
| `TREE_GRID` | A treeview-like columned list | [class@Gtk.ColumnView] |
| `WINDOW` | An application window | [class@Gtk.Window] |
| `...` | … |
See the [WAI-ARIA](https://www.w3.org/WAI/PF/aria/appendices#quickref) list

View File

@ -144,7 +144,7 @@ collect_states (GtkAtSpiContext *self,
set_atspi_state (&states, ATSPI_STATE_VISIBLE);
set_atspi_state (&states, ATSPI_STATE_SHOWING);
if (ctx->accessible_role == GTK_ACCESSIBLE_ROLE_WINDOW)
if (ctx->accessible_role == GTK_ACCESSIBLE_ROLE_APPLICATION)
{
if (gtk_accessible_get_platform_state (accessible, GTK_ACCESSIBLE_PLATFORM_STATE_ACTIVE))
set_atspi_state (&states, ATSPI_STATE_ACTIVE);
@ -1170,7 +1170,7 @@ gtk_at_spi_context_platform_change (GtkATContext *ctx,
/* Orca tracks the window:activate and window:deactivate events on top
* levels to decide whether to track other AT-SPI events
*/
if (gtk_accessible_get_accessible_role (accessible) == GTK_ACCESSIBLE_ROLE_WINDOW)
if (gtk_accessible_get_accessible_role (accessible) == GTK_ACCESSIBLE_ROLE_APPLICATION)
{
if (state)
emit_window_event (self, "activate");

View File

@ -148,7 +148,9 @@
*
* # Accessibility
*
* `GtkWindow` uses the %GTK_ACCESSIBLE_ROLE_WINDOW role.
* Until GTK 4.10, `GtkWindow` used the `GTK_ACCESSIBLE_ROLE_WINDOW` role.
*
* Since GTK 4.12, `GtkWindow` uses the `GTK_ACCESSIBLE_ROLE_APPLICATION` role.
*
* # Actions
*
@ -1222,7 +1224,7 @@ gtk_window_class_init (GtkWindowClass *klass)
gtk_widget_class_set_css_name (widget_class, I_("window"));
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_WINDOW);
gtk_widget_class_set_accessible_role (widget_class, GTK_ACCESSIBLE_ROLE_APPLICATION);
}
/**

View File

@ -5,7 +5,7 @@ window_role (void)
{
GtkWidget *window = gtk_window_new ();
gtk_test_accessible_assert_role (window, GTK_ACCESSIBLE_ROLE_WINDOW);
gtk_test_accessible_assert_role (window, GTK_ACCESSIBLE_ROLE_APPLICATION);
gtk_window_destroy (GTK_WINDOW (window));
}