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

[selectors-4] Could we add :mouse-focus or :keyboard-focus? #3092

Closed
AlphaGo88 opened this issue Sep 10, 2018 · 3 comments
Closed

[selectors-4] Could we add :mouse-focus or :keyboard-focus? #3092

AlphaGo88 opened this issue Sep 10, 2018 · 3 comments

Comments

@AlphaGo88
Copy link

Hello!

the focus pseudo

Sometimes we want to distinguish between a keyboard focus and a mouse focus. For example, when the element is focused by a mouse click, we want to hide the outline. It would be great if this can be done by css rather than javascript.
Something like :mouse-focus or :keyboard-focus would help.

@bkardell
Copy link
Contributor

There is :focus-visible https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible which might give you what you really want, but a specific use case would help if not

@tabatkins
Copy link
Member

Yeah, :focus-visible is what you want here - it's a subset of :focus that matches the actual browser algorithm for when to show the focus ring and when to not.

@AlphaGo88
Copy link
Author

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants