mdgriffith / style-elements

Create styles that don't mysteriously break!
http://package.elm-lang.org/packages/mdgriffith/style-elements/latest
BSD 3-Clause "New" or "Revised" License
445 stars 49 forks source link

Focus area is 100 % of it's parent not just the input box + label. #87

Open AionDev opened 7 years ago

AionDev commented 7 years ago

I added a orange background to the hole text input. this is the parent - with orange - it contains the feedback too - and it responds to click

Code looks something like this:

Input.text DefaultInput
        ([ width << px <| toFloat 80
         , height <| px 36
         , paddingLeft 15
         ]
        )
        { onChange = NoOpWithText
        , value = "0"
        , label =
            Input.placeholder
                { text = "pret"
                , label =
                    el InputLabelStyle [ verticalCenter ] (text "lei")
                        |> el None [ vary MakeRed True ]
                        |> Input.labelRight
                }
        , options =
            [ "longer feedback here."
                |> text
                >> el FeedbackText [ vary InfoStyle True ]
                >> Input.errorBelow
            ]
        }
        |> el None [ vary MakeOrange True, width content ]

I expect that the onFocus event will be triggered only when clicking on the input box - or on the label -- but not when clicking on the parent containing everything including the feedback. Thanks 😃

littleStudent commented 7 years ago

I am having the exact same issue. Is there a way around this for now?

AionDev commented 7 years ago

@littleStudent i coudn't find a way, I left it like this for now, but if you rely need it maybe use html node and convert back using html function- pain in the ass i know 😁