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

Fix false positives for focus-visible in selector-pseudo-class-no-unknown #3886

Closed
mo opened this issue Jan 13, 2019 · 3 comments · Fixed by #3887
Closed

Fix false positives for focus-visible in selector-pseudo-class-no-unknown #3886

mo opened this issue Jan 13, 2019 · 3 comments · Fixed by #3887
Labels
good first issue is good for newcomers status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule

Comments

@mo
Copy link
Contributor

mo commented Jan 13, 2019

Running stylelint 9.9.0 using stylelint-config-recommended on the following file:

:focus-visible {
	color: red;
}

...reports the error:

test.css
 1:1  ✖  Unexpected unknown pseudo-class selector ":focus-visible"   selector-pseudo-class-no-unknown

:focus-visible is a new pseudo class coming in CSS Selectors v4.

It's currently implemented behind a prefix in Firefox and behind a flag in Chrome, see status here:
https://caniuse.com/#search=focus-visible

Chrome implementation is tracked by this bug:
https://bugs.chromium.org/p/chromium/issues/detail?id=817199&desc=3

Some people are already using it via this polyfill:
https://github.com/WICG/focus-visible

It would be nice if stylelint did not report this pseudo class as "unknown".

@jeddy3
Copy link
Member

jeddy3 commented Jan 13, 2019

@mo Thanks for the report.

Yes, this should be considered known. For those interested, it's in the Level 4 Selector Working Draft.

It should just be the case of adding it to this list, if you'd like a submit a PR.

@jeddy3 jeddy3 added status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule good first issue is good for newcomers labels Jan 13, 2019
@jeddy3 jeddy3 changed the title :focus-visible pseudo class is not recognized by stylelint Fix false positives for focus-visible in selector-pseudo-class-no-unknown Jan 13, 2019
@mo
Copy link
Contributor Author

mo commented Jan 13, 2019

@jeddy3 If I also wanted to write a testcase, in which file should I put it?

@jeddy3
Copy link
Member

jeddy3 commented Jan 13, 2019

Each rule has it own test folder within.

You should just need to add a :focus-visible {} item to the accept array around this line of the selector-pseudo-class-no-unknown rule.

FYI, docs on running tests.

mo added a commit to mo/stylelint that referenced this issue Jan 13, 2019
mo added a commit to mo/stylelint that referenced this issue Jan 13, 2019
mo added a commit to mo/stylelint that referenced this issue Jan 13, 2019
mo added a commit to mo/stylelint that referenced this issue Jan 13, 2019
jeddy3 pushed a commit that referenced this issue Jan 16, 2019
Fix false positives for focus-visible in selector-pseudo-class-no-unknown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue is good for newcomers status: ready to implement is ready to be worked on by someone type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

2 participants