Focus CSS state not being applied #1560
Replies: 3 comments 3 replies
-
Hey! Thank you for your question! You are not doing anything wrong. Currently the This is because we are using the "activedescendant" strategy right now instead of the "roving tab index" strategy. I don't think we will change this behaviour any time soon, which means that you won't be able to differentiate between mouse/keyboard (it's also why we combined both into the same While I can see the use case (e.g.: showing a focus ring), how would you handle a Do you have an example or can you share your use case on what you want to do differently if you are using a mouse vs a keyboard? |
Beta Was this translation helpful? Give feedback.
-
I noticed with the Tab and Popover component that using :focus-visible on the button that triggers the component, it also "triggers" the focus state thus ignoring the fact that I would like to have a keyboard only focus. Is this related to the same thing? I get that for elements that can accept input, it is not a bad idea (like the Combobox for example). Is there a way around this? I use keyboard-only focus for practically all |
Beta Was this translation helpful? Give feedback.
-
I replaced all focus states on my website with focus-visible As I see this button focus can be overwritten by passing ref to the close render prop but I am not using close handler i am closing it by clicking outside so I'm not able to achieve that. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Our components generally have two visual states- hover and focus (
:focus-visible
) to differentiate between pointer / mouse and keyboard interactions. According to #132, I should be able to leverage these states via CSS to style list items (currently grappling withListbox
) but I'm not seeing:focus
nor:focus-visible
states on those items. I can leverage theactive
prop but, as the other person complained about a couple of years ago, it is true for both hover and focus.I suspected that our setup, which uses detached DOM via floating-ui, was the culprit but I pulled up simpler sandbox examples and also observed a lack of aforementioned pseudo-classes. Am I doing something wrong?
Beta Was this translation helpful? Give feedback.
All reactions