Skip to content

Bug: Weird stuff is happening with Html.Styled.Lazy #522

Open

Description

@Kurren123

Minimal ellie example

Code from the ellie example:

module Main exposing (main)

import Browser
import Html.Styled exposing (..)
import Html.Styled.Lazy exposing (..)
import Css exposing (..)
import Html.Styled.Attributes exposing (css)

strings = 
    [ "A" , "B", "C"]

viewString : String -> Html msg 
viewString str =
     let 
         strColour = 
             if str == "A" 
             then rgb 166 11 0
             else rgb 0 110 29
     in 
         option [ css [ color strColour ] ] [ text str ]

viewStrings : Html msg
viewStrings =     
    strings
        |> List.map (\txt -> lazy viewString txt )
        |> select [  ]

view _ =
    viewStrings
    |> toUnstyled


main : Program () () ()
main =
    Browser.sandbox
        { init = ()
        , view = view
        , update = \_ _ -> ()
        }

I want to colour the individual options differently.

Without lazy:
image

With lazy:

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions