Skip to content

Commit 70dd33f

Browse files
devversionjelbourn
authored andcommitted
chore(examples): disable user select in ripple-overview example (#13257)
* Since people often click on the ripple container of the example, we need to disable the user selection because otherwise the text will be accidentally selected. * Disables the `no-prefixes` rule for example style files. The examples are not auto-prefixed and we don't want to show the `/** stylelint-disable` comments in the examples.
1 parent 8d25fd1 commit 70dd33f

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/material-examples/ripple-overview/ripple-overview-example.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@
55
width: 300px;
66
height: 300px;
77
line-height: 300px;
8+
9+
user-select: none;
10+
-webkit-user-select: none;
11+
-moz-user-select: none;
12+
-ms-user-select: none;
13+
814
-webkit-user-drag: none;
915
-webkit-tap-highlight-color: transparent;
1016
}

stylelint-config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"./tools/stylelint/no-top-level-ampersand-in-mixin/index.js"
99
],
1010
"rules": {
11-
"material/no-prefixes": [["last 2 versions", "not ie <= 10", "not ie_mob <= 10"]],
11+
"material/no-prefixes": [true, {
12+
"browsers": ["last 2 versions", "not ie <= 10", "not ie_mob <= 10"],
13+
"filePattern": "**/!(*-example.css)"
14+
}],
1215
"material/selector-no-deep": true,
1316
"material/no-nested-mixin": true,
1417
"material/no-ampersand-beyond-selector-start": [true, {

tools/stylelint/no-prefixes/no-prefixes.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
const stylelint = require('stylelint');
22
const NeedsPrefix = require('./needs-prefix');
33
const parseSelector = require('stylelint/lib/utils/parseSelector');
4+
const minimatch = require('minimatch');
45

56
const ruleName = 'material/no-prefixes';
67
const messages = stylelint.utils.ruleMessages(ruleName, {
@@ -14,9 +15,17 @@ const messages = stylelint.utils.ruleMessages(ruleName, {
1415
/**
1516
* Stylelint plugin that warns for unprefixed CSS.
1617
*/
17-
const plugin = stylelint.createPlugin(ruleName, browsers => {
18+
const plugin = stylelint.createPlugin(ruleName, (isEnabled, options) => {
1819
return (root, result) => {
19-
if (!stylelint.utils.validateOptions(result, ruleName, {})) return;
20+
if (!isEnabled || !stylelint.utils.validateOptions(result, ruleName, {})) {
21+
return;
22+
}
23+
24+
const {browsers, filePattern} = options;
25+
26+
if (filePattern && !minimatch(root.source.input.file, filePattern)) {
27+
return;
28+
}
2029

2130
const needsPrefix = new NeedsPrefix(browsers);
2231

0 commit comments

Comments
 (0)