source: trip-planner-front/node_modules/postcss-focus-visible/README.md

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 3.5 KB
Line 
1# PostCSS Focus Visible [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
2
3[![NPM Version][npm-img]][npm-url]
4[![CSS Standard Status][css-img]][css-url]
5[![Build Status][cli-img]][cli-url]
6[![Support Chat][git-img]][git-url]
7
8[PostCSS Focus Visible] lets you use the `:focus-visible` pseudo-class in
9CSS, following the [Selectors Level 4 specification].
10
11It is the companion to the [focus-visible polyfill].
12
13```css
14:focus:not(:focus-visible) {
15 outline: none;
16}
17
18/* becomes */
19
20:focus:not(.focus-visible) {
21 outline: none;
22}
23
24:focus:not(:focus-visible) {
25 outline: none;
26}
27```
28
29[PostCSS Focus Visible] duplicates rules using the `:focus-visible` pseudo-class
30with a `.focus-visible` class selector, the same selector used by the
31[focus-visible polyfill]. This replacement selector can be changed using the
32`replaceWith` option. Also, the preservation of the original `:focus-visible`
33rule can be disabled using the `preserve` option.
34
35## Usage
36
37Add [PostCSS Focus Visible] to your project:
38
39```bash
40npm install postcss-focus-visible --save-dev
41```
42
43Use [PostCSS Focus Visible] to process your CSS:
44
45```js
46const postcssFocusVisible = require('postcss-focus-visible');
47
48postcssFocusVisible.process(YOUR_CSS /*, processOptions, pluginOptions */);
49```
50
51Or use it as a [PostCSS] plugin:
52
53```js
54const postcss = require('postcss');
55const postcssFocusVisible = require('postcss-focus-visible');
56
57postcss([
58 postcssFocusVisible(/* pluginOptions */)
59]).process(YOUR_CSS /*, processOptions */);
60```
61
62[PostCSS Focus Visible] runs in all Node environments, with special
63instructions for:
64
65| [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) |
66| --- | --- | --- | --- | --- | --- |
67
68## Options
69
70### preserve
71
72The `preserve` option defines whether the original selector should remain. By
73default, the original selector is preserved.
74
75```js
76focusVisible({ preserve: false });
77```
78
79```css
80:focus:not(:focus-visible) {
81 outline: none;
82}
83
84/* becomes */
85
86:focus:not(.focus-visible) {
87 outline: none;
88}
89```
90
91### replaceWith
92
93The `replaceWith` option defines the selector to replace `:focus-visible`. By
94default, the replacement selector is `.focus-visible`.
95
96```js
97focusVisible({ replaceWith: '[focus-visible]' });
98```
99
100```css
101:focus:not(:focus-visible) {
102 outline: none;
103}
104
105/* becomes */
106
107:focus:not([focus-visible]) {
108 outline: none;
109}
110
111:focus:not(:focus-visible) {
112 outline: none;
113}
114```
115
116[cli-img]: https://img.shields.io/travis/jonathantneal/postcss-focus-visible.svg
117[cli-url]: https://travis-ci.org/jonathantneal/postcss-focus-visible
118[css-img]: https://cssdb.org/badge/focus-within-pseudo-class.svg
119[css-url]: https://cssdb.org/#focus-visible-pseudo-class
120[git-img]: https://img.shields.io/badge/support-chat-blue.svg
121[git-url]: https://gitter.im/postcss/postcss
122[npm-img]: https://img.shields.io/npm/v/postcss-focus-visible.svg
123[npm-url]: https://www.npmjs.com/package/postcss-focus-visible
124
125[focus-visible polyfill]: https://github.com/WICG/focus-visible
126[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
127[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
128[PostCSS]: https://github.com/postcss/postcss
129[PostCSS Focus Visible]: https://github.com/jonathantneal/postcss-focus-visible
130[PostCSS Loader]: https://github.com/postcss/postcss-loader
131[Selectors Level 4 specification]: https://www.w3.org/TR/selectors-4/#the-focus-visible-pseudo
Note: See TracBrowser for help on using the repository browser.