{"id":13564604,"url":"https://github.com/csstools/postcss-focus-visible","last_synced_at":"2025-04-03T21:31:10.106Z","repository":{"id":47009165,"uuid":"92107792","full_name":"csstools/postcss-focus-visible","owner":"csstools","description":"Use the :focus-visible pseudo-selector in CSS","archived":true,"fork":false,"pushed_at":"2021-12-16T16:35:49.000Z","size":87,"stargazers_count":52,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-20T03:48:32.192Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-focus-visible","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/csstools.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-22T23:20:36.000Z","updated_at":"2024-09-18T11:08:02.000Z","dependencies_parsed_at":"2022-09-13T08:40:50.596Z","dependency_job_id":null,"html_url":"https://github.com/csstools/postcss-focus-visible","commit_stats":null,"previous_names":["jonathantneal/postcss-focus-ring","jonathantneal/postcss-focus-visible"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-focus-visible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-focus-visible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-focus-visible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/csstools%2Fpostcss-focus-visible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/csstools","download_url":"https://codeload.github.com/csstools/postcss-focus-visible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245984882,"owners_count":20704867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T13:01:33.515Z","updated_at":"2025-04-03T21:31:09.821Z","avatar_url":"https://github.com/csstools.png","language":"CSS","funding_links":[],"categories":["CSS"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e⚠️ PostCSS Focus Visible was moved to \u003ca href=\"https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-focus-visible\"\u003e@csstools/postcss-plugins\u003c/a\u003e. ⚠️ \u003cbr\u003e\n\u003ca href=\"https://github.com/csstools/postcss-plugins/discussions/75\"\u003eRead the announcement\u003c/a\u003e\u003c/div\u003e\n\n# PostCSS Focus Visible [\u003cimg src=\"https://postcss.github.io/postcss/logo.svg\" alt=\"PostCSS Logo\" width=\"90\" height=\"90\" align=\"right\"\u003e][postcss]\n\n[\u003cimg alt=\"npm version\" src=\"https://img.shields.io/npm/v/postcss-focus-visible.svg\" height=\"20\"\u003e][npm-url]\n[\u003cimg alt=\"CSS Standard Status\" src=\"https://cssdb.org/badge/focus-within-pseudo-class.svg\" height=\"20\"\u003e][css-url]\n[\u003cimg alt=\"Build Status\" src=\"https://github.com/csstools/postcss-focus-visible/workflows/test/badge.svg\" height=\"20\"\u003e][cli-url]\n[\u003cimg alt=\"support chat\" src=\"https://img.shields.io/badge/support-chat-blue.svg\" height=\"20\"\u003e][git-url]\n\n[PostCSS Focus Visible] lets you use the `:focus-visible` pseudo-class in\nCSS, following the [Selectors Level 4 specification].\n\nIt is the companion to the [focus-visible polyfill].\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:focus:not(:focus-visible) {\n  outline: none;\n}\n\n/* becomes */\n\n:focus:not(.focus-visible) {\n  outline: none;\n}\n\n:focus:not(:focus-visible) {\n  outline: 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]. This replacement selector can be changed using the\n`replaceWith` option. Also, the preservation of the original `:focus-visible`\nrule can be disabled using the `preserve` option.\n\n## Usage\n\nAdd [PostCSS Focus Visible] to your project:\n\n```bash\nnpm install postcss-focus-visible --save-dev\n```\n\nUse [PostCSS Focus Visible] to process your CSS:\n\n```js\nconst postcssFocusVisible = require('postcss-focus-visible');\n\npostcssFocusVisible.process(YOUR_CSS /*, processOptions, pluginOptions */);\n```\n\nOr use it as a [PostCSS] plugin:\n\n```js\nconst postcss = require('postcss');\nconst postcssFocusVisible = require('postcss-focus-visible');\n\npostcss([\n  postcssFocusVisible(/* pluginOptions */)\n]).process(YOUR_CSS /*, processOptions */);\n```\n\n[PostCSS Focus Visible] runs in all Node environments, with special\ninstructions for:\n\n| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |\n| --- | --- | --- | --- | --- | --- |\n\n## Options\n\n### preserve\n\nThe `preserve` option defines whether the original selector should remain. By\ndefault, the original selector is preserved.\n\n```js\nfocusVisible({ preserve: false });\n```\n\n```css\n:focus:not(:focus-visible) {\n  outline: none;\n}\n\n/* becomes */\n\n:focus:not(.focus-visible) {\n  outline: 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\nfocusVisible({ replaceWith: '[focus-visible]' });\n```\n\n```css\n:focus:not(:focus-visible) {\n  outline: none;\n}\n\n/* becomes */\n\n:focus:not([focus-visible]) {\n  outline: none;\n}\n\n:focus:not(:focus-visible) {\n  outline: none;\n}\n```\n\n[cli-url]: https://github.com/csstools/postcss-focus-visible/actions/workflows/test.yml?query=workflow/test\n[css-url]: https://cssdb.org/#focus-visible-pseudo-class\n[git-url]: https://gitter.im/postcss/postcss\n[npm-url]: https://www.npmjs.com/package/postcss-focus-visible\n\n[focus-visible polyfill]: https://github.com/WICG/focus-visible\n[Gulp PostCSS]: https://github.com/postcss/gulp-postcss\n[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss\n[PostCSS]: https://github.com/postcss/postcss\n[PostCSS Focus Visible]: https://github.com/csstools/postcss-focus-visible\n[PostCSS Loader]: https://github.com/postcss/postcss-loader\n[Selectors Level 4 specification]: https://www.w3.org/TR/selectors-4/#the-focus-visible-pseudo\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fpostcss-focus-visible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcsstools%2Fpostcss-focus-visible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcsstools%2Fpostcss-focus-visible/lists"}