mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 12:50:04 -04:00
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. A widget in `focus_widgets_cache` has asked for focus in an earlier pass, so it is one we can hand focus to in `begin_pass`, 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. `interested_in_focus` keeps the same grant as a fallback, for the first pass a widget is focusable in, and the two share `take_focus_from_accesskit`. 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.