{"name":"postcss-focus-visible","description":"Use the :focus-visible pseudo-selector in CSS","version":"11.0.0","contributors":[{"name":"Antonio Laguna","email":"antonio@laguna.es","url":"https://antonio.laguna.es"},{"name":"Romain Menke","email":"romainmenke@gmail.com"}],"license":"MIT-0","funding":[{"type":"github","url":"https://github.com/sponsors/csstools"},{"type":"opencollective","url":"https://opencollective.com/csstools"}],"engines":{"node":">=20.19.0"},"type":"module","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.mjs"}},"dependencies":{"postcss-selector-parser":"^7.1.1"},"peerDependencies":{"postcss":"^8.4"},"scripts":{},"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-focus-visible#readme","repository":{"type":"git","url":"git+https://github.com/csstools/postcss-plugins.git","directory":"plugins/postcss-focus-visible"},"bugs":{"url":"https://github.com/csstools/postcss-plugins/issues"},"keywords":["a11y","accessibility","button","contenteditable","css","cursor","focus","input","javascript","js","keyboards","mice","mouse","pen","pointer","postcss","postcss-plugin","pseudos","ring","select","selectors","textarea","touch","trackpad"],"gitHead":"fc560fbe3d9f6aaaf4d884134720078bf6e7cd55","_id":"postcss-focus-visible@11.0.0","_nodeVersion":"25.1.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-VG1a9kBKizUBWS66t5xyB4uLONBnvZLCmZXxT40FALu8EF0QgVZBYy5ApC0KhmpHsv+pvHMJHB3agKHwmocWjw==","shasum":"b56b41fa86fad518a66965a9b70e75578aef598b","tarball":"http://registry-npm.ywwl.com/postcss-focus-visible/download/postcss-focus-visible-11.0.0.tgz","fileCount":6,"unpackedSize":8398,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIG1tAIOV1Oe7oWCW9AUIqQrERiywtggWbYEg7M2mUebIAiBxu4v+3AN3byvOGkEUTVOaV2Wid9AE2MBygfsRGoRuow=="}],"size":3593,"noattachment":false,"key":"/postcss-focus-visible/-/postcss-focus-visible-11.0.0.tgz"},"_npmUser":{"name":"romainmenke","email":"romainmenke@gmail.com"},"directories":{},"maintainers":[{"name":"jonathantneal","email":"jonathantneal@hotmail.com"},{"name":"alaguna","email":"sombragriselros@gmail.com"},{"name":"romainmenke","email":"romainmenke@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postcss-focus-visible_11.0.0_1768375347384_0.3946298136645987"},"_hasShrinkwrap":false,"readme":"# PostCSS Focus Visible [<img src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\">][PostCSS]\n\n`npm install postcss-focus-visible --save-dev`\n\n[PostCSS Focus Visible] lets you use the `:focus-visible` pseudo-class in CSS, \nfollowing the [Selectors Level 4 specification].\n\nTo use this feature you need to do two things :\n- add the [PostCSS plugin](#usage) that transforms the selector into a class or attribute\n- add the [focus-visible polyfill] that sets the attribute or class on elements in a browser\n\n[!['Can I use' table](https://caniuse.bitsofco.de/image/css-focus-visible.png)](https://caniuse.com/#feat=css-focus-visible)\n\n```css\n\n```css\n:focus:not(:focus-visible) {\n\toutline: none;\n}\n\n/* becomes */\n\n:focus:not(.focus-visible).js-focus-visible, .js-focus-visible :focus:not(.focus-visible) {\n\toutline: none;\n}\n:focus:not(:focus-visible) {\n\toutline: none;\n}\n```\n\n[PostCSS Focus Visible] duplicates rules using the `:focus-visible` pseudo-class\nwith a `.focus-visible` class selector, the same selector used by the\n[focus-visible polyfill].\n\n## Usage\n\nAdd [PostCSS Focus Visible] to your project:\n\n```bash\nnpm install postcss postcss-focus-visible --save-dev\n```\n\nUse it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssFocusVisible = require('postcss-focus-visible');\n\npostcss([\n\tpostcssFocusVisible(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n\n\n## Options\n\n### preserve\n\nThe `preserve` option determines whether the original notation\nis preserved. By default, it is preserved.\n\n```js\npostcssFocusVisible({ preserve: false })\n```\n\n```css\n:focus:not(:focus-visible) {\n\toutline: none;\n}\n\n/* becomes */\n\n:focus:not(.focus-visible).js-focus-visible, .js-focus-visible :focus:not(.focus-visible) {\n\toutline: none;\n}\n```\n\n### replaceWith\n\nThe `replaceWith` option defines the selector to replace `:focus-visible`. By\ndefault, the replacement selector is `.focus-visible`.\n\n```js\npostcssFocusVisible({ replaceWith: '[data-focus-visible-added]' })\n```\n\n```css\n:focus:not(:focus-visible) {\n\toutline: none;\n}\n\n/* becomes */\n\n<example.preserve-true.expect.css>\n```\n\nNote that if you want to keep using [focus-visible polyfill], the only \nacceptable value would be `[data-focus-visible-added]`,\ngiven that the polyfill does not support arbitrary values.\n\n### disablePolyfillReadyClass\n\nThe `disablePolyfillReadyClass` option determines if selectors are prefixed with an indicator class.\nThis class is only set on your document if the polyfill loads and is needed.\n\nBy default this option is `false`.\nSet this to `true` to prevent the class from being added.\n\n```js\npostcssFocusVisible({ disablePolyfillReadyClass: true })\n```\n\n```css\n:focus:not(:focus-visible) {\n\toutline: none;\n}\n\n/* becomes */\n\n:focus:not(.focus-visible) {\n\toutline: none;\n}\n:focus:not(:focus-visible) {\n\toutline: none;\n}\n```\n\n[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#focus-visible-pseudo-class\n[discord]: https://discord.gg/bUadyRwkJS\n[npm-url]: https://www.npmjs.com/package/postcss-focus-visible\n\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Focus Visible]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-focus-visible\n[Selectors Level 4 specification]: https://www.w3.org/TR/selectors-4/#the-focus-visible-pseudo\n[focus-visible polyfill]: https://github.com/WICG/focus-visible\n","publish_time":1768375347638,"_cnpm_publish_time":1768375347638,"dist-tags":{"latest":"11.0.0"}}