yakui icon indicating copy to clipboard operation
yakui copied to clipboard

Request focus on widget

Open Uriopass opened this issue 4 months ago • 2 comments

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();

Uriopass avatar Feb 14 '24 15:02 Uriopass