I use cascading lists of ul and li elements (nodes) to create a navigation 
tree menu.

I keep a list of which nodes are open in my model, and when I click on a 
node, I toggle its presence in the list of open nodes.

I can then display or hide relevant nodes depending on whether they are 
open or not.

onoffstyle : List String -> String -> Attribute Msg
onoffstyle openNodes s =
         let oright = filter (\o -> o==s) openNodes
         in case (isEmpty oright) of
            True -> style [("display","none")] 
            _ -> style [("display","block")]

I set up a cascading list as follows with ul and li to create a tree menu. 
'Crumple' is the message I use to toggle the open node list.

drivers : Model -> Html Msg
drivers m = li [S.listyle,onClick (Crumple "drivers") ] 
            [text "Software Drivers"
            , ul [S.ulstyle,S.onoffstyle m.opens "drivers"]
              [text "R"
              ,li [onClick (Crumple "drivers1")] [text "Drivers 1"]
              ,li [onClick (Crumple "drivers2")] [text "Drivers 2"]
              ,ul []
                [text "A"
                ,hr[][]
                ,text "B"]

              ]
            ]

However, even if I click on one of the innermost tree items, let us say, 
the "A" node, the onClick event in the outermost li fires (top line of the 
code).

Is that correct behaviour? It didn't happen in 0.14, but does in 0.17, 
throwing my navigation out of sync.

If it is correct behaviour, how would I get round it?

Thanks.

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