Hi Mark. Try to send a message on your port as a command in your `init` 
function. In the port JS handler you run `requestAnimationFrame` and find 
and focus your element there. Does that work?

On Wednesday, January 4, 2017 at 8:24:40 AM UTC-8, Mark Hamburg wrote:
>
> We just had a similar concern come up but with the existing Dom package. 
> If the init for a model wants to generate a focus command — the autofocus 
> property is proving unreliable for reasons as yet undetermined — how can we 
> arrange to have that command execute after the view has actually been 
> instantiated? Do we need to chain off of animation ticks and wait a round 
> or two before the focus task runs?
>
> Mark
>
> On Jan 3, 2017, at 10:54 PM, Richard Feldman <[email protected] 
> <javascript:>> wrote:
>
> Hi Sebastian,
>
> Elm batches DOM updat`es using requestAnimationFrame 
> <https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame>,
>  
> so you should be able to delay until after the next DOM update by wrapping 
> your entire callback (starting from let el = document.body.querySelector(
> selector)) in a call to requestAnimationFrame.
>
> See if that works!
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to