From 8a3c5ecb29ab8679d57035f2cb51d7ec8a5c080f Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 21 Nov 2026 00:36:08 +0000 Subject: [PATCH] egui: Context::with_accesskit_parents reads the pass's AccessKit parent map --- crates/egui/src/context.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crates/egui/src/context.rs b/crates/egui/src/context.rs index 4cc84fa9..6b332efa 100644 --- a/crates/egui/src/context.rs +++ b/crates/egui/src/context.rs @@ -4355,6 +4355,22 @@ impl Context { }) } + /// Reads this pass's AccessKit parents so far: each id that [`Self::register_accesskit_parent`] + /// (or a widget's creation) gave a parent, mapped to that parent. + /// + /// The `Context` lock is held while the given closure is called! + /// + /// Returns `None` if accesskit is off. + pub fn with_accesskit_parents(&self, reader: impl FnOnce(&IdMap) -> R) -> Option { + self.write(|ctx| { + ctx.viewport() + .this_pass + .accesskit_state + .as_ref() + .map(|state| reader(&state.parent_map)) + }) + } + /// Report the widget with this id as the focused node of this pass's accessibility tree. /// /// This is for widgets that show an active item without taking keyboard focus, such as a