-
Notifications
You must be signed in to change notification settings - Fork 47
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
Unable to set focus on :focus-visible only #128
Comments
This component works similarly to any other focusable input, for example, But you can achieve the desired behavior with JS + CSS. Here is an example of how to do it https://codepen.io/sneas/pen/bGzKJvR |
Thanks, that was quick! That’s exactly the behaviour I would expect. In my opinion, It would make more sense for it to work as an input type=“range” (slider) component and not an input=“text”. As long as you don't enter text, the focus ring is not as critical and you should be able to control its visibility using ":focus-visible". Chromium blog explains how :focus-visible should work (https://blog.chromium.org/2020/09/giving-users-and-developers-more.html):
|
You made a pretty good point, and I'm currently researching how this can be achieved. https://twitter.com/sneasio/status/1733438507731812785 Feel free to contribute if you have any ideas. |
Thanks for looking into this! I love this component as it’s very lightweight and has all the main functionality an image comparison slider should have. For now, I'm using your suggested solution on my website. No idea either on how to achieve this :( I could only find a discussion where a WebKit developer explains why Shadow DOM only gets focus but not focus-visible. Not helpful, but still interesting to read. Apparently, the specs are not very clear on the expected behaviour. |
Seems like we've reached the edge of the spec :) |
I'm trying to set the focus ring only when the user selects it via keyboard (:focus-visible), but NOT when the user interacts with it via a click or touch ie. no focus ring unless it's for accessibility.
Clicking/taping on it seems to trigger a focus action which doesn't allow me to show the focus ring only when the user navigates to the component via keyboard.
The text was updated successfully, but these errors were encountered: