How to focus a particular element i just rendered?

86 views
Skip to first unread message

Mark Skipper

unread,
Jun 24, 2016, 5:41:01 PM6/24/16
to Elm Discuss
Im rewriting some JS in Elm. 
When the user clicks on an element the JS replaces the element with an <input> with the same contents, and calls .focus() 
In Elm I'm keeping the editing state in a boolean and view draws the component as <input> when were editing, and the display element when we're not.
But I don't know how to focus the <input> element when I render it. Autofocus doesn't do it.

Am i going about this the right way?
Is there a way to call .focus() from existing elm libraries or do I need to write custom JS interop?

Thanks

Mark


Mark Skipper

unread,
Jun 24, 2016, 5:42:20 PM6/24/16
to Elm Discuss
Reply all
Reply to author
Forward
0 new messages