Help and docs
Sign in

R60 feat: make onFocus and onBlur take func()

Browse files
grindlemire 23d 17 files +1 ~67 -17
Landed bygrindlemireas 11bd2e64 · with 7 other reviews See in history

onFocus/onBlur passed the element to the callback while onMouseEnter,
onMouseLeave, and onActivate take func(). The element argument invited
changing the element directly, which a re-render discards; nothing in the
repo used it, and the docs and LSP already described these as func().
WithOnFocus, WithOnBlur, SetOnFocus, and SetOnBlur now take func().

Callers passing func(*tui.Element) get a compile error; drop the
parameter and keep what the callback changes in state, or capture the
element through a ref.