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

[form-core] focused-visible attr FormControls #1206

Closed
tlouisse opened this issue Feb 10, 2021 · 4 comments · Fixed by #1357
Closed

[form-core] focused-visible attr FormControls #1206

tlouisse opened this issue Feb 10, 2021 · 4 comments · Fixed by #1357
Labels
enhancement New feature or request

Comments

@tlouisse
Copy link
Member

tlouisse commented Feb 10, 2021

Expected behavior

I can style focused state for active elements enabled by keyboard (tab) interaction, like: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible, via a [focused-visible] attribute

Actual Behavior

I can only style the [focused] state, which also shows a focus ring on click of an element

Additional context

Should be solved in FocusMixin via prop:

focusedVisible: {
   type: Boolean,
   attribute: 'focused-visible',
   reflect: true,
}

possible implementations

@tlouisse tlouisse changed the title [form-core] focus-visible attr FormControls [form-core] focused-visible attr FormControls Feb 11, 2021
@tlouisse tlouisse added the enhancement New feature or request label Apr 19, 2021
@daKmoR
Copy link
Collaborator

daKmoR commented Apr 30, 2021

can we add this as progressive enhancement via the native :focus-visible... e.g. only css and no js?

@tlouisse
Copy link
Member Author

can we add this as progressive enhancement via the native :focus-visible... e.g. only css and no js?

Also had a solution for this in a branch that I will push :)
I think the overhead for supporting the polyfill is very minimal (just an attribute check). A consumer will then be responsible for loading the polyfill. Looking at #1267 (reply in thread), there seems to be demand for the polyfill

@tlouisse
Copy link
Member Author

tlouisse commented May 2, 2021

Or did you mean no js solution at all @daKmoR... just a recommendation in the docs? In that case, I would say we need this in the FocusMixin, because we need to be able to style the host when the focusable element has :focus-visible (we need this in our own extension layer to put a border around the switch FIeld when the button within has focus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants