Skip to content

Commit 8f2d8e0

Browse files
authored
EncryptView: make warnings messages screen reader accessible (#897)
1 parent 1ff480b commit 8f2d8e0

File tree

2 files changed

+33
-3
lines changed

2 files changed

+33
-3
lines changed

src/Views/EncryptView.vala

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ public class EncryptView : AbstractInstallerView {
7272
"slate"
7373
);
7474

75+
var message_box = new Gtk.ListBox () {
76+
selection_mode = BROWSE
77+
};
78+
message_box.add_css_class (Granite.STYLE_CLASS_RICH_LIST);
79+
message_box.add_css_class (Granite.STYLE_CLASS_BACKGROUND);
80+
message_box.append (protect_row);
81+
message_box.append (restart_row);
82+
message_box.append (keyboard_row);
83+
7584
pw_error_revealer = new ErrorRevealer (".");
7685
pw_error_revealer.label_widget.add_css_class (Granite.STYLE_CLASS_WARNING);
7786

@@ -114,9 +123,7 @@ public class EncryptView : AbstractInstallerView {
114123
title_area.append (title_label);
115124

116125
content_area.valign = CENTER;
117-
content_area.append (protect_row);
118-
content_area.append (restart_row);
119-
content_area.append (keyboard_row);
126+
content_area.append (message_box);
120127
content_area.append (password_box);
121128

122129
encrypt_button = new Gtk.Button.with_label (_("Set Encryption Password")) {
@@ -154,6 +161,21 @@ public class EncryptView : AbstractInstallerView {
154161
confirm_entry.is_valid = confirm_password ();
155162
update_next_button ();
156163
});
164+
165+
// Forward keys so we can type immediate when list is focused
166+
var key_controller = new Gtk.EventControllerKey ();
167+
key_controller.key_pressed.connect ((keyval, keycode, state) => {
168+
if (Gdk.keyval_to_unicode (keyval) != 0) {
169+
key_controller.forward (pw_entry.get_delegate ());
170+
pw_entry.grab_focus ();
171+
pw_entry.select_region (-1, -1);
172+
return Gdk.EVENT_STOP;
173+
}
174+
175+
return Gdk.EVENT_PROPAGATE;
176+
});
177+
178+
message_box.add_controller (key_controller);
157179
}
158180

159181
private bool check_password () {

src/Widgets/DescriptionRow.vala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,13 @@ public class DescriptionRow : Gtk.Box {
3434
spacing = 12;
3535
append (image);
3636
append (description_label);
37+
38+
// prevent titles from being skipped
39+
map.connect (() => {
40+
parent.update_property (
41+
Gtk.AccessibleProperty.LABEL, description,
42+
-1
43+
);
44+
});
3745
}
3846
}

0 commit comments

Comments
 (0)