Accessible description read twice by Orca when using gtk_accessible_update_property
When gtk_accessible_update_property
with a description is called between construction and rooting of a widget, the description is read twice by orca, when the widget receives focus for the first time.
I saw that an object:property-change:accessible-description
ATSPI event is sent when the widget is focussed, and not before.
The application I used to hear the description read twice with orca:
#include <gtk/gtk.h>
static void
on_activate_cb (GtkApplication *application,
gpointer basically_a_fancy_null_pointer)
{
GtkApplicationWindow *window;
GtkBox *box;
GtkButton *button_without_description;
GtkButton *button_with_description;
window = GTK_APPLICATION_WINDOW (gtk_application_window_new (application));
gtk_window_set_title (GTK_WINDOW (window), "This is weird, isn't it?");
gtk_window_set_default_size (GTK_WINDOW (window), 300, 200);
box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_VERTICAL, 12));
button_without_description = GTK_BUTTON (gtk_button_new_with_label ("Do Not Click"));
button_with_description = GTK_BUTTON (gtk_button_new_with_label ("Do Nothing!"));
gtk_accessible_update_property (GTK_ACCESSIBLE (button_with_description),
GTK_ACCESSIBLE_PROPERTY_DESCRIPTION,
"A description so fancy, you want to hear it twice.",
-1);
gtk_box_append (box, GTK_WIDGET (button_without_description));
gtk_box_append (box, GTK_WIDGET (button_with_description));
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (box));
gtk_window_present (GTK_WINDOW (window));
}
int
main (int argc,
char **argv)
{
GtkApplication *application;
int status;
application = gtk_application_new("it.bewares.snippets.A11yDescription",
G_APPLICATION_DEFAULT_FLAGS);
g_signal_connect (application, "activate", G_CALLBACK (on_activate_cb), NULL);
status = g_application_run (G_APPLICATION (application), argc, argv);
g_object_unref (application);
return status;
}
The first button is not important here, but it helps with checking when said ATSPI event is received on. I am not sure, it is related to the issue. I wanted to include all my findings nonetheless.
The script I used to check when the ATSPI event came in:
#!/usr/bin/env python3
import pyatspi
pyatspi.Registry.registerEventListener(lambda e: print(e), "object:property-change:accessible-description")
pyatspi.Registry.start()
Tested with versions
- ATSPI 2.50.0
- GTK 4.12.5 and 4.13.8-90d84a2a
- Orca 45.2
Edited by Markus Göllnitz