Gathering detailed insights and metrics for postcss-focus-visible
Gathering detailed insights and metrics for postcss-focus-visible
Gathering detailed insights and metrics for postcss-focus-visible
Gathering detailed insights and metrics for postcss-focus-visible
postcss-focus
PostCSS plugin to add :focus-visible selector to every :hover for keyboard accessibility
postcss-focus-visible-within
PostCSS plugin to add the :focus-visible-within pseudoselector
postcss-hover-focus-visible
PostCSS plugin to add :focus-visible selector and/or :focus to every :hover, this is for keyboard accessibility
npm install postcss-focus-visible
Typescript
Module System
Min. Node Version
Node Version
NPM Version
CSS (43.3%)
JavaScript (30.21%)
TypeScript (22.88%)
HTML (3.03%)
Nunjucks (0.48%)
Shell (0.1%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT-0 License
983 Stars
4,382 Commits
77 Forks
9 Watchers
5 Branches
132 Contributors
Updated on Jul 14, 2025
Latest Version
10.0.1
Package Id
postcss-focus-visible@10.0.1
Unpacked Size
9.58 kB
Size
3.61 kB
File Count
7
NPM Version
10.7.0
Node Version
22.1.0
Published on
Oct 23, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
npm install postcss-focus-visible --save-dev
PostCSS Focus Visible lets you use the :focus-visible
pseudo-class in CSS,
following the Selectors Level 4 specification.
To use this feature you need to do two things :
1 2```pcss 3:focus:not(:focus-visible) { 4 outline: none; 5} 6 7/* becomes */ 8 9:focus:not(.focus-visible).js-focus-visible, .js-focus-visible :focus:not(.focus-visible) { 10 outline: none; 11} 12:focus:not(:focus-visible) { 13 outline: none; 14}
PostCSS Focus Visible duplicates rules using the :focus-visible
pseudo-class
with a .focus-visible
class selector, the same selector used by the
focus-visible polyfill.
Add PostCSS Focus Visible to your project:
1npm install postcss postcss-focus-visible --save-dev
Use it as a PostCSS plugin:
1const postcss = require('postcss'); 2const postcssFocusVisible = require('postcss-focus-visible'); 3 4postcss([ 5 postcssFocusVisible(/* pluginOptions */) 6]).process(YOUR_CSS /*, processOptions */);
The preserve
option determines whether the original notation
is preserved. By default, it is preserved.
1postcssFocusVisible({ preserve: false })
1:focus:not(:focus-visible) {
2 outline: none;
3}
4
5/* becomes */
6
7:focus:not(.focus-visible).js-focus-visible, .js-focus-visible :focus:not(.focus-visible) {
8 outline: none;
9}
The replaceWith
option defines the selector to replace :focus-visible
. By
default, the replacement selector is .focus-visible
.
1postcssFocusVisible({ replaceWith: '[data-focus-visible-added]' })
1:focus:not(:focus-visible) {
2 outline: none;
3}
4
5/* becomes */
6
7<example.preserve-true.expect.css>
Note that if you want to keep using focus-visible polyfill, the only
acceptable value would be [data-focus-visible-added]
,
given that the polyfill does not support arbitrary values.
The disablePolyfillReadyClass
option determines if selectors are prefixed with an indicator class.
This class is only set on your document if the polyfill loads and is needed.
By default this option is false
.
Set this to true
to prevent the class from being added.
1postcssFocusVisible({ disablePolyfillReadyClass: true })
1:focus:not(:focus-visible) {
2 outline: none;
3}
4
5/* becomes */
6
7:focus:not(.focus-visible) {
8 outline: none;
9}
10:focus:not(:focus-visible) {
11 outline: none;
12}
No vulnerabilities found.
Reason
30 commit(s) and 7 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
no binaries found in the repo
Reason
1 existing vulnerabilities detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 1/24 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More