1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 12:50:04 -04:00
Files
egui/crates
Lucas Meurer 80ff62e2be Hand out an AccessKit focus request at the start of the pass
AccessKit asks for focus by node id, and `Focus::interested_in_focus` only picks
the request up once the widget itself runs. Everything that reads the focus
before the widget — styling it, for one — therefore saw the old focus, so a text
edit was styled unfocused in the very pass it got focused, and lost its focus
ring for a frame.

AccessKit names the widget by the node id it read from the last tree we sent, so
the widget has been here before and is in `focus_widgets_cache`: `begin_pass` can
hand out the focus right away, the same way a `request_focus` from the last pass
is handed out. Memory then holds the focus before any widget runs, and
`Ui::widget_style` needs to know nothing about focus at all.

For the same reason the request never has to outlive the pass it arrives in — a
widget that has not run yet cannot have been named by it — so the pending
`id_requested_by_accesskit` field becomes a local.

The four `text_edit_*` snapshots gain a caret along with the ring, because the
field is now focused for real in that pass rather than a pass later.

Also drops `fallback_gap` from `TextEdit`, which has no `gap` of its own to defer
to, and moves the `DragValue` `HasClasses` impl above its test module.
2026-08-27 13:24:55 +02:00
..