1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 22:53:14 -04:00

Make scroll bars and resize splitters visible to accesskit (#7804)

This commit is contained in:
Emil Ernerfeldt
2025-12-22 21:25:12 +01:00
committed by GitHub
parent 4f6eabffb8
commit 24ac9e193d
5 changed files with 17 additions and 1 deletions

View File

@@ -9,7 +9,8 @@ use epaint::Margin;
use crate::{
Context, CursorIcon, Id, NumExt as _, Pos2, Rangef, Rect, Response, Sense, Ui, UiBuilder,
UiKind, UiStackInfo, Vec2, Vec2b, emath, epaint, lerp, pass_state, pos2, remap, remap_clamp,
UiKind, UiStackInfo, Vec2, Vec2b, WidgetInfo, emath, epaint, lerp, pass_state, pos2, remap,
remap_clamp,
};
#[derive(Clone, Copy, Debug)]
@@ -1286,6 +1287,8 @@ impl Prepared {
// Also: it make sense to detect any hover where the scroll bar _will_ be.
let response = ui.interact(max_bar_rect, interact_id, sense);
response.widget_info(|| WidgetInfo::new(crate::WidgetType::ScrollBar));
// top/bottom of a horizontal scroll (d==0).
// left/rigth of a vertical scroll (d==1).
let cross = if scroll_style.floating {

View File

@@ -959,6 +959,9 @@ fn resize_interaction(
},
true,
);
response.widget_info(|| WidgetInfo::new(crate::WidgetType::ResizeHandle));
SideResponse {
hover: response.hovered(),
drag: response.dragged(),

View File

@@ -679,6 +679,8 @@ impl WidgetInfo {
WidgetType::Panel => "panel",
WidgetType::ProgressIndicator => "progress indicator",
WidgetType::Window => "window",
WidgetType::ScrollBar => "scroll bar",
WidgetType::ResizeHandle => "resize handle",
WidgetType::Label | WidgetType::Other => "",
};

View File

@@ -663,6 +663,10 @@ pub enum WidgetType {
Window,
ResizeHandle,
ScrollBar,
/// If you cannot fit any of the above slots.
///
/// If this is something you think should be added, file an issue.

View File

@@ -871,6 +871,10 @@ impl Response {
WidgetType::Panel => Role::Pane,
WidgetType::ProgressIndicator => Role::ProgressIndicator,
WidgetType::Window => Role::Window,
WidgetType::ResizeHandle => Role::Splitter,
WidgetType::ScrollBar => Role::ScrollBar,
WidgetType::Other => Role::Unknown,
});
if !info.enabled {