-
Notifications
You must be signed in to change notification settings - Fork 26
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
Adaptive color not working #8
Comments
The code is actually working as intended, but this is a pathologically bad case for how the ring decides on a color to choose. You can see the simple logic here: focus-rings/src/FocusColorUtils.tsx Lines 12 to 22 in a0ca56d
As you can see, it first checks for This is logic that I honestly kind of skimped on because it was "good enough" for our use case with a bright blue ring. But it's something that can and should probably be done better. I don't have any immediate ideas for improvement, but it's something to look at for sure! |
Hey, can we have a prop to disable this code snippet ? When I try to force another color, I think its prevent the change. I would like to do something like :
This css code is working because the content of my rings disappeared when I do :
The use-case is quite simple : I want to put focus-rings on card, and these cards in a slider (SwiperJS for exemple). At the moment, I have the following behavior : --> I move with tabs, then I drag my Slider. After Dragging / Swiping I don't want to disable focus-rings, juste hide the color of the border
How can I do this ? Thx 😎 |
@Thisisjuke I think the behavior you're seeing there, where the ring "detaches" from the element that it's supposed to be tracking, is likely because you're missing a Something like: <ScrollingContainer ref={scrollingRef}>
<FocusRingScope containerRef={scrollingRef}>
{...yourScrollableChildren}
</FocusRingScope>
</ScrollingContainer> should make the rings track the elements properly. To your original question, if you want to just disable the ring while the scrolling happens, you can also pass the We will probably add some flexibility for being able to inject a "best color selector" function or the like in the future, but hopefully one or both of those solutions is sufficient for your use case. |
Hey thanks for your answer ! The screenshot was not the precise use-case we are looking for, just the global idea. I checked all the pages and we are now using a Perhaps, this colors behavior ( The question is: can we choose the color for each FocusRing via a property of the FocusRing or the FocusRingScope? But above all to have the possibility of not passing by a check inside of
If the above question is no, are you speaking about a close future or not at all ? If it become critical in our project (I hope not ahah) I might look for a dirty workaround or discuss to do a PR. EDIT: discussed with my team, we can do the PR, just to be sure how you see this feature 😃 Thx for, your time 🙏 |
There are three (apparently undocumented) However, I'd probably try to avoid doing that too much since it's hard to maintain and add to all of your focus rings across an app. Instead, I do think being able to inject your own color selector function would be good. If you have bandwidth to work on a PR, that would be great! Otherwise I'll probably try to get around to it soon.
This sounds like somehow the background color calculation isn't working, but I'm not really sure why without being able to see more of the context. |
Hello there, Now, you are doing things like this :
Maybe you can do something like that :
Now, if the saturation is below @faultyserver What do you think about this one ? |
@faultyserver @dougmacknz |
I've forked the hosted example and changed the scrollable area to have a black background. I've also changed the
--focus-primary
var to black.https://codesandbox.io/s/bold-sun-lx1im?file=/public/index.html
The focus ring should be adapting and showing a visible focus ring in this case right? At the moment it's still just creating a black focus ring.
The text was updated successfully, but these errors were encountered: