{"id":13851619,"url":"https://github.com/postcss/postcss-focus","last_synced_at":"2025-04-05T13:10:00.208Z","repository":{"id":30902332,"uuid":"34460124","full_name":"postcss/postcss-focus","owner":"postcss","description":"PostCSS plugin to add :focus selector to every :hover for keyboard accessibility","archived":false,"fork":false,"pushed_at":"2024-07-18T14:18:22.000Z","size":522,"stargazers_count":117,"open_issues_count":0,"forks_count":14,"subscribers_count":9,"default_branch":"main","last_synced_at":"2024-10-29T14:38:24.565Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/postcss.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"postcss","github":"ai"}},"created_at":"2015-04-23T14:08:59.000Z","updated_at":"2024-07-18T14:18:19.000Z","dependencies_parsed_at":"2023-01-14T17:55:11.796Z","dependency_job_id":"31cd276c-799d-4a94-9cef-35d135c9f2be","html_url":"https://github.com/postcss/postcss-focus","commit_stats":{"total_commits":90,"total_committers":5,"mean_commits":18.0,"dds":"0.21111111111111114","last_synced_commit":"b106380965b9a2707de4d24dc3128caccd0258f1"},"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-focus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-focus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-focus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/postcss%2Fpostcss-focus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/postcss","download_url":"https://codeload.github.com/postcss/postcss-focus/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339158,"owners_count":20923014,"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-04T22:00:36.672Z","updated_at":"2025-04-05T13:10:00.190Z","avatar_url":"https://github.com/postcss.png","language":"JavaScript","readme":"# PostCSS Focus\n\n\u003cimg align=\"right\" width=\"135\" height=\"95\"\n     title=\"Philosopher’s stone, logo of PostCSS\"\n     src=\"https://postcss.org/logo-leftp.svg\"\u003e\n\n[PostCSS] plugin to add `:focus-visible` selector to every `:hover`\nfor keyboard accessibility.\n\nSee also [postcss-pseudo-class-enter] for more explicit way.\n\n[postcss-pseudo-class-enter]: https://github.com/jonathantneal/postcss-pseudo-class-enter\n[PostCSS]:                    https://github.com/postcss/postcss\n\n```css\n*:focus-visible {\n  outline: 0;\n}\n.button:hover {\n  background: red;\n}\n```\n\n```css\n*:focus-visible {\n  outline: 0;\n}\n.button:hover {\n    background: red;\n}\n.button:focus-visible {\n  background: red;\n}\n```\n\nIf there is a `:focus-visible` selector, it will be excluded\nfrom the processing.\n\n```css\n.a:hover, .b:hover {\n  outline: 0;\n}\n.b:focus-visible {\n  background: red;\n}\n```\n\n```css\n.a:hover, .b:hover, .a:focus-visible {\n  outline: 0;\n}\n.b:focus-visible {\n  background: red;\n}\n```\n\n\u003ca href=\"https://evilmartians.com/?utm_source=postcss-focus\"\u003e\n  \u003cimg src=\"https://evilmartians.com/badges/sponsored-by-evil-martians.svg\"\n       alt=\"Sponsored by Evil Martians\" width=\"236\" height=\"54\"\u003e\n\u003c/a\u003e\n\n## Usage\n\n**Step 1:** Install plugin:\n\n```sh\nnpm install --save-dev postcss postcss-focus\n```\n\n**Step 2:** Check your project for existing PostCSS config: `postcss.config.js`\nin the project root, `\"postcss\"` section in `package.json`\nor `postcss` in bundle config.\n\nIf you do not use PostCSS, add it according to [official docs]\nand set this plugin in settings.\n\n**Step 3:** Add the plugin to plugins list:\n\n```diff\nmodule.exports = {\n  plugins: [\n+   require('postcss-focus'),\n    require('autoprefixer')\n  ]\n}\n```\n\n## Options\n\n```js\nmodule.exports = {\n  plugins: [\n    require('postcss-focus')({\n      oldFocus: true,\n      splitRules: false,\n    })\n  ]\n}\n```\n\n### `oldFocus`\n\nType: `boolean`. Default: `false`.\n\nEnable if you need to add the old `:focus` instead of `:focus-visible` selector\nto every `:hover`.\n\n### `splitRules`\n\nType: `boolean`. Default: `true`.\n\nDisable if you need to append the selector. If you don't need to support browsers, which doesn't support `:focus-visible`, you can safely disable this option.\n\n[official docs]: https://github.com/postcss/postcss#usage\n","funding_links":["https://opencollective.com/postcss","https://github.com/sponsors/ai"],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostcss%2Fpostcss-focus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpostcss%2Fpostcss-focus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpostcss%2Fpostcss-focus/lists"}