-
Notifications
You must be signed in to change notification settings - Fork 111
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
Multiple elements simultaneously render with Element.focused attributes #47
Comments
It seems like .s:focus ~ .box-0px0px0px2px240-70-70-102-fs:not(.focus) {
box-shadow: 0px 0px 0px 2px rgba(240,70,70,0.4);
} This is a style generated by my app (the long class name is the name of the second button that "accidentally" gets focussed) |
@z5h - I noticed that if you use |
I don't understand what that css-class is supposed to do either. I worked around this for now by putting each of my focused elements inside an |
Interestingly, if you add child elements the focus is no longer propagated whether using the |
Workaround, thanks to @edkv: wrap each button in an |
We've run into this issue over at dillonkearns/elm-pages-starter#3 as well. We actually have this issue with links, not buttons. We use Using workarounds with single elements is "kind of ok", but it is manual. I worry that this gives people more reason to avoid focus styles, in addition to the existing misunderstandings around them. @mdgriffith, is there an update on this bug? |
Also happens with elm-ui 1.1.5. #bug #has-ellie |
I'm currently working at a material design package for elm-ui. Both suggested workarounds do Not work for me: Wrapping a button in an Element.el: https://ellie-app.com/8X2Q9V3BfVpa1 Adding an Using LayoutWith: https://ellie-app.com/8X2QtwWJnhka1 As you can see this workaround does not work |
@Orasund Your first example (https://ellie-app.com/8X2Q9V3BfVpa1) has a single element with the focused style when I test it with Firefox or Chrome. If I remove the wrapping Also from my tests, the bug is fixed in |
Here's my source code: button : ButtonStyle msg -> Button msg -> Element msg
button style { onPress, text, icon } =
Input.button
(style.container
++ (if onPress == Nothing then
style.ifDisabled
else
style.otherwise
)
)
{ onPress = onPress
, label =
Element.row style.labelRow
[ icon |> Element.map never
, Element.text text |> Element.el style.text
]
} As you can see the styling of the button is defined in my I need to ensure that
Adding a It's good to know that the bug is fixed. When will the patch be released? I wanted to publish the package today, is it better to wait? |
Patch is now released! |
SSCCE: https://ellie-app.com/3zyY5PfnbG8a1
Expected behavior
Only one element can have focus at a time. So only one element should be decorated with
Element.focused
decorations at a time.Actual behaviour
Clicking (focusing) a button will render that button and all following buttons as focused.
Versions
The text was updated successfully, but these errors were encountered: