mirror of
https://github.com/emilk/egui.git
synced 2026-09-01 22:30:03 -04:00
Accessibility inspector plugin (#7368)
Adds an accessibility inspector plugin that shows the current AccessKit tree: https://github.com/user-attachments/assets/78f4f221-1bd2-4ce4-adf5-fc3b00f5c16c Macos has a built in accessibility inspector, but it doesn't seem to work with AccessKit / eframe so this provides some insight into the accesskit state. This also showed a couple issues that are easy to fix: - [ ] Links show up as `Label` instead of links - [ ] Not all supported actions are advertised (e.g. scrolling) - [ ] The resize handles in windows shouldn't be focusable - [ ] Checkbox has no value - [ ] Menus should have the button as parent widget (not 100% sure on this one) Currently the plugin lives in the demo app, but I think it should be moved somewhere else. Maybe egui_extras? This could also be relevant for #4650
This commit is contained in:
@@ -83,6 +83,25 @@ impl Id {
|
||||
pub(crate) fn accesskit_id(&self) -> accesskit::NodeId {
|
||||
self.value().into()
|
||||
}
|
||||
|
||||
/// Create a new [`Id`] from a high-entropy value. No hashing is done.
|
||||
///
|
||||
/// This can be useful if you have an [`Id`] that was converted to some other type
|
||||
/// (e.g. accesskit::NodeId) and you want to convert it back to an [`Id`].
|
||||
///
|
||||
/// # Safety
|
||||
/// You need to ensure that the value is high-entropy since it might be used in
|
||||
/// a [`IdSet`] or [`IdMap`], which rely on the assumption that [`Id`]s have good entropy.
|
||||
///
|
||||
/// The method is not unsafe in terms of memory safety.
|
||||
///
|
||||
/// # Panics
|
||||
/// If the value is zero, this will panic.
|
||||
#[doc(hidden)]
|
||||
#[expect(unsafe_code)]
|
||||
pub unsafe fn from_high_entropy_bits(value: u64) -> Self {
|
||||
Self(NonZeroU64::new(value).expect("Id must be non-zero."))
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Id {
|
||||
|
||||
Reference in New Issue
Block a user