[fractal] sidebar: Tell accessibility tools about expanded state of categories



commit f0ac677121b6c6b447a6183827b4893f2d7ea7ab
Author: Lukáš Tyrychtr <lukastyrychtr gmail com>
Date:   Wed Oct 5 17:15:39 2022 +0200

    sidebar: Tell accessibility tools about expanded state of categories

 src/session/sidebar/category_row.rs | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/src/session/sidebar/category_row.rs b/src/session/sidebar/category_row.rs
index a06c0651f..9a46cc396 100644
--- a/src/session/sidebar/category_row.rs
+++ b/src/session/sidebar/category_row.rs
@@ -1,6 +1,6 @@
 use adw::subclass::prelude::BinImpl;
 use gettextrs::gettext;
-use gtk::{self, glib, prelude::*, subclass::prelude::*, CompositeTemplate};
+use gtk::{self, accessible, glib, prelude::*, subclass::prelude::*, CompositeTemplate};
 
 use crate::session::sidebar::{Category, CategoryType};
 
@@ -148,10 +148,19 @@ impl CategoryRow {
             self.unset_state_flags(gtk::StateFlags::CHECKED);
         }
 
+        self.set_expanded_accessibility_state(expanded);
         self.imp().expanded.set(expanded);
         self.notify("expanded");
     }
 
+    fn set_expanded_accessibility_state(&self, expanded: bool) {
+        if let Some(p) = self.parent() {
+            if let Some(p) = p.parent() {
+                p.update_state(&[accessible::State::Expanded(Some(expanded))])
+            }
+        }
+    }
+
     pub fn label(&self) -> Option<String> {
         let to_type = self.category()?.type_();
         let from_type = self.show_label_for_category();


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]