yakui
yakui copied to clipboard
Request focus on widget
Currently writing a simple chat. I'd like to be able to automatically focus the textbox when pressing "T" and the textbox appears.
There appears to be some state about which widget is focused as there is WidgetEvent::FocusChanged
.
I was thinking of adding a method to the Dom with a widget id. Would that be a good API?
so you could do
let resp = textbox(...);
context::dom().request_focus(resp.id);
could even be implemented on top of Response<T>
let resp = textbox(...);
resp.request_focus();