status/backlight: Fix a11y label of discrete level buttons
Point the discrete level buttons to the corresponding labels, so that they don't appear as plain "button" in screen readers. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3545>
This commit is contained in:
parent
64c9baf412
commit
83a8810003
@ -106,17 +106,23 @@ const DiscreteItem = GObject.registerClass({
|
|||||||
return 100 * Math.min(keyIndex, this.nLevels - 1) / (this.nLevels - 1);
|
return 100 * Math.min(keyIndex, this.nLevels - 1) / (this.nLevels - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
_addLevelButton(key, label, iconName) {
|
_addLevelButton(key, labelText, iconName) {
|
||||||
const box = new St.BoxLayout({
|
const box = new St.BoxLayout({
|
||||||
style_class: 'keyboard-brightness-level',
|
style_class: 'keyboard-brightness-level',
|
||||||
vertical: true,
|
vertical: true,
|
||||||
x_expand: true,
|
x_expand: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const label = new St.Label({
|
||||||
|
text: labelText,
|
||||||
|
x_align: Clutter.ActorAlign.CENTER,
|
||||||
|
});
|
||||||
|
|
||||||
box.button = new St.Button({
|
box.button = new St.Button({
|
||||||
styleClass: 'icon-button',
|
styleClass: 'icon-button',
|
||||||
canFocus: true,
|
canFocus: true,
|
||||||
iconName,
|
iconName,
|
||||||
|
labelActor: label,
|
||||||
});
|
});
|
||||||
box.add_child(box.button);
|
box.add_child(box.button);
|
||||||
|
|
||||||
@ -124,10 +130,7 @@ const DiscreteItem = GObject.registerClass({
|
|||||||
this.value = this._levelToValue(key);
|
this.value = this._levelToValue(key);
|
||||||
});
|
});
|
||||||
|
|
||||||
box.add_child(new St.Label({
|
box.add_child(label);
|
||||||
text: label,
|
|
||||||
x_align: Clutter.ActorAlign.CENTER,
|
|
||||||
}));
|
|
||||||
|
|
||||||
this.add_child(box);
|
this.add_child(box);
|
||||||
this._levelButtons.set(key, box);
|
this._levelButtons.set(key, box);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user