checkbox: Improve accessibility of check boxes for Orca users
Set the label actor, so Orca presents the label text when the check box has focus. Also change the role to ATK_ROLE_CHECKBOX. Fixes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/2517
This commit is contained in:
parent
308b58175f
commit
16f4e4dc4c
@ -1,5 +1,5 @@
|
|||||||
/* exported CheckBox */
|
/* exported CheckBox */
|
||||||
const { Clutter, GObject, Pango, St } = imports.gi;
|
const { Atk, Clutter, GObject, Pango, St } = imports.gi;
|
||||||
|
|
||||||
var CheckBox = GObject.registerClass(
|
var CheckBox = GObject.registerClass(
|
||||||
class CheckBox extends St.Button {
|
class CheckBox extends St.Button {
|
||||||
@ -15,6 +15,7 @@ class CheckBox extends St.Button {
|
|||||||
toggle_mode: true,
|
toggle_mode: true,
|
||||||
can_focus: true,
|
can_focus: true,
|
||||||
});
|
});
|
||||||
|
this.set_accessible_role(Atk.Role.CHECK_BOX);
|
||||||
|
|
||||||
this._box = new St.Bin({ y_align: Clutter.ActorAlign.START });
|
this._box = new St.Bin({ y_align: Clutter.ActorAlign.START });
|
||||||
container.add_actor(this._box);
|
container.add_actor(this._box);
|
||||||
@ -22,6 +23,7 @@ class CheckBox extends St.Button {
|
|||||||
this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
|
this._label = new St.Label({ y_align: Clutter.ActorAlign.CENTER });
|
||||||
this._label.clutter_text.set_line_wrap(true);
|
this._label.clutter_text.set_line_wrap(true);
|
||||||
this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
|
this._label.clutter_text.set_ellipsize(Pango.EllipsizeMode.NONE);
|
||||||
|
this.set_label_actor(this._label);
|
||||||
container.add_actor(this._label);
|
container.add_actor(this._label);
|
||||||
|
|
||||||
if (label)
|
if (label)
|
||||||
|
Loading…
Reference in New Issue
Block a user