Actually, the existing documentation for Html.Keyed comes close to saying what 
needs to be said:

> Works just like Html.node, but you add a unique identifier to each child 
> node. You want this when you have a list of nodes that is changing: adding 
> nodes, removing nodes, etc. In these cases, the unique identifiers help make 
> the DOM modifications more efficient.

In addition to make the modifications more efficient, it makes them more 
correct because it avoids having positional shifts cause confusion.

Basic rule: If the set of children for an Html node can change, then you should 
use Html.Keyed for that node to avoid problems with DOM element state or focus.

Side note: Do not reuse keys under a node if you don't want state preserved. 
(That's the issue that started the parent thread.)

Mark

-- 
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