Notify that a gtk.entry has invalid value (original) (raw)
I’m adding accessibility to my application, and currently I just disable the “Save” button if a text entry has an invalid value (like putting a non-IP address in an IP address text entry). I tried with
gtk_accessible_update_state (GTK_ACCESSIBLE (widget),
GTK_ACCESSIBLE_STATE_INVALID,
GTK_ACCESSIBLE_INVALID_TRUE,
-1);
to specify an invalid value in the Gtk.Entry widget, but Orca doesn’t specify that there is an error. Do I have to manually notify it using Gtk.Widget.announce()
? Or is it a bug in the accessibility toolkit?
ebassi (Emmanuele Bassi) June 13, 2025, 2:17pm 2
States are generally managed by the toolkit, and in this case it’s entirely possible that Orca is not watching for a state change.
In general, using an invalid
state is not a great solution; even on the web it has a caveat:
While it is always preferable to programmatically associate specific error description with the failed field, the page’s design or the framework employed may sometimes constrain the author’s ability to do so.
You can easily set the description property to convey the error state of that field as part of the validation process, in the same way as you add/remove CSS classes to modify the visual appearances of the entry.