I don't have a port. I'm just using the standard Dom package. But it would 
presumably have similar issues with attempts to interact with elements that 
aren't there yet.

Mark

> On Jan 4, 2017, at 9:30 AM, Sebastian Seilund <seb...@gmail.com> wrote:
> 
> 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 <richard....@gmail.com> wrote:
>>> 
>>> Hi Sebastian,
>>> 
>>> Elm batches DOM updat`es using 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 elm-discuss...@googlegroups.com.
>>> 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 elm-discuss+unsubscr...@googlegroups.com.
> 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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to