Automattic / Automattic/jetpack
CSS Tidy: Add `user-select` support
- Dominant language
- PHP
- Stars
- 1.8k
- Forks
- 898
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 774
Description
### Steps to Reproduce
Add this CSS (to prevent text-selection on sites) on Additional CSS:
```
body {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera and Firefox */
}
```
That CSS is to prevent text selection. The CSS code is from this guide:
https://www.wpbeginner.com/wp-tutorials/how-to-prevent-text-selection-and-copy-paste-in-wordpress-easy/
### What I expected to happen
The CSS to work and for the users to be able to protect their contents
### What actually happened
CSS get stripped out. It seems like the CSS selectors there are not supported
### Context
User report:
4276268-zd-woothemes
Slack discussion:
p1630917680387500-slack-C03TY6J1A
p1630918555002300-slack-C029WGXE5T4
### Operating System
Windows, macOS, Linux, Android, iOS
### OS Version
_No response_
### Browser
Chrome/Chromium, Firefox, Microsoft Edge, Microsoft Edge (legacy), Safari
### Browser Version(s)
_No response_
### Is this specific to applied theme? If so, what is the theme name?
_No response_
### Simple/Atomic
Simple
### Console and/or error logs
_No response_
### Number of Users Impacted
_No response_
### Available Workarounds
None
### Reproducibility
_No response_
### Other information
_No response_
Contributor guide
Research direction
Reproduce the issue by adding the provided declarations to WordPress Additional CSS and observe which rules CSS Tidy strips. Trace the CSS Tidy sanitization entry point, then verify that the listed user-select declarations are retained and that the Additional CSS reproduces the intended behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, wordpress
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100