From 9b822fb47c74c1053a1fa1fb5d785635f6348af3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Sun, 12 Nov 2023 12:29:03 +0100 Subject: [PATCH] components: Set default accessible role of Avatar as an image And hide children from the a11y tree. --- src/components/avatar.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/avatar.rs b/src/components/avatar.rs index 998b74a3..52d949c8 100644 --- a/src/components/avatar.rs +++ b/src/components/avatar.rs @@ -29,6 +29,8 @@ mod imp { fn class_init(klass: &mut Self::Class) { AvatarImage::static_type(); Self::bind_template(klass); + + klass.set_accessible_role(gtk::AccessibleRole::Img); } fn instance_init(obj: &InitializingObject) { @@ -84,8 +86,14 @@ mod imp { } impl WidgetImpl for Avatar {} - impl BinImpl for Avatar {} + + impl AccessibleImpl for Avatar { + fn first_accessible_child(&self) -> Option { + // Hide the children in the a11y tree. + None + } + } } glib::wrapper! {