reflex-frp / reflex-dom

Web applications without callbacks or side-effects. Reflex-DOM brings the power of functional reactive programming (FRP) to the web. Build HTML and other Document Object Model (DOM) data with a pure functional interface.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
358 stars 145 forks source link

implement _*ElementConfig_setFocus #435

Open plt-amy opened 2 years ago

plt-amy commented 2 years ago

Basically the same thing as _inputElementConfig_setValue but for calling .focus() on the underlying element when the event fires.

rubenmoor commented 2 years ago

Second this. This is my workaround, cf.

https://github.com/reflex-frp/reflex-dom/issues/424

import GHCJS.DOM.HTMLElement (focus)

-- post build auto focus: the post build event happens before the element
-- is mounted. postmount event waits for pull request to be accepted
-- https://github.com/reflex-frp/reflex-dom-semui/issues/18
ePb <- delay 0.1 =<< getPostBuild
performEvent_ $ ePb $> focus (_inputElement_raw kbInput)