litespeedtech / litespeedtech/lscache_wp
UCSS issue with :hover styles
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 257
- Forks
- 123
- PR merge metrics
- No merged PRs in 30d
Description
I'm having an issue when UCSS is enabled where it doesn't seem to be picking up on hover styles. I've tried adding them to the UCSS Whitelist setting but it doesn't include them in the generated file.
An example class that I'm trying to whitelist is a selector like this: `.site-header .primary-menu>li>a:hover`
In the first instance, I'm not sure why the UCSS generator isn't picking up these classes? It picks up all the other anchor `a` classes fine, but seems to ignore the `:hover` variants.
In debugging this I first tried to add `.primary-menu>li>a:hover` but this didn't work. I then tried broadening the criteria and added `*:hover` to my whitelist. However, this then produced an error: `UCSS generator error: Cannot read property 'valueOf' of undefined`. The generated UCSS was then a null file.
I suspected this might be because of the colon in the whitelist and so I removed it and tried just `*hover`. This got the UCSS to generate again however it didn't include any of the hover classes in the generated file. Is this not how the wildcard works or is it getting caught up on the colon character too?
Finally I thought I'd broaden it even more and tried `*hover*` but this had the same result. It just generated the UCSS file without the required hover classes. What do I need to do to get these to be included?
Some examples of the selectors it's not picking up:
```
.site-header .primary-menu>li>a:hover
.no-touch .cat-links a:hover:before
.no-touch .posts .post:hover .overlay-label
.no-touch .posts .post:hover img
```
For now I've had to disable the UCSS feature but it would be good to have a way for it to properly detect these classes... or at least allow them to be whitelisted.
**Site report: `MSGQPLRK`**
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue through the UCSS whitelist and generator using the reported hover selectors, including `*:hover` and `*hover*`. Trace why hover selectors are omitted and why `*:hover` produces the `valueOf` error; done means the generated UCSS contains the required hover rules and is not null.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100