Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Focus - Sibling Elements are unintentionally focused #126

Closed
jgrenat opened this issue Jul 7, 2019 · 1 comment
Closed

Focus - Sibling Elements are unintentionally focused #126

jgrenat opened this issue Jul 7, 2019 · 1 comment
Labels
bug This is definitely a bug, meaning it is unintended behavior. It likely needs an ellie and a test.

Comments

@jgrenat
Copy link

jgrenat commented Jul 7, 2019

Hello!

First, thanks for this great project! I've encountered a bug in the way the focus styles are handled:

Expected behavior
When focusing an element, only this element should be shown focused.

Current behavior
The next siblings of the element are also shown as focused

SSCCE

SSCCE
module Main exposing (main)

import Element exposing (Color, Element, el, focused, layout, link, row, spacing, text)
import Element.Border as Border
import Element.Region as Region
import Html exposing (Html)


main : Html msg
main =
    layout [] links


links : Element msg
links =
    row [ spacing 10 ]
        [ siteLink "Elm website" "https://elm-lang.org/"
        , siteLink "Elm-ui" "https://package.elm-lang.org/packages/mdgriffith/elm-ui/latest/Element"
        ]


siteLink : String -> String -> Element msg
siteLink label url =
    link [ focused [ Border.glow blue 2 ] ]    
        { url = url
        , label = text label
        }


blue : Color
blue =
    Element.fromRgb255
        { red = 100
        , green = 180
        , blue = 250
        , alpha = 1
        }

Workaround

Wrapping each link inside an el fixes the behaviour:

siteLink : String -> String -> Element msg
siteLink label url =
    el [] <|
        link [ focused [ Border.glow blue 2 ] ]    
            { url = url
            , label = text label
            }

Versions

  • OS: MacOS
  • Browser: Chrome
  • Browser Version: 74
  • Elm Version: 0.19
  • Elm UI Version: latest (1.1.0)
@mdgriffith mdgriffith added the bug This is definitely a bug, meaning it is unintended behavior. It likely needs an ellie and a test. label Jul 8, 2019
@edkv
Copy link

edkv commented Jul 27, 2019

this is the same as #47

@mdgriffith mdgriffith changed the title Focus styles Focus - Sibling Elements are unintentionally focused May 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is definitely a bug, meaning it is unintended behavior. It likely needs an ellie and a test.
Projects
None yet
Development

No branches or pull requests

3 participants