MadLittleMods / MadLittleMods/postcss-increase-specificity

Does not recognize root element in some cases

Open
#23 4 comments 1 reaction 0 assignees View on GitHub
bug help wanted
Dominant language
JavaScript
Stars
51
Forks
12
PR merge metrics
No merged PRs in 30d

Description

It looks like this plugin [tries](https://github.com/MadLittleMods/postcss-increase-specificity/blob/f952606dca9ec9bd76ebc27065417e0c8c5c2824/index.js#L16) not to break `html` selectors, but it doesn't handle more complex selectors containing `html`.

Test case:

**Input:**

```css
html[data-whatintent=keyboard] .button:focus {}
```

**Actual output:**

```css
:not(#\9):not(#\9):not(#\9) html[data-whatintent=keyboard] .button:focus {}
```

These styles never end up being applied because `html` has no parent element

**Expected output:**

```css
html[data-whatintent=keyboard]:not(#\9):not(#\9):not(#\9) .button:focus {}
```

It should append stackableRoot to the root selector, instead of prepending

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in index.js around line 16, where root selectors are handled, and reproduce the issue with the provided html[data-whatintent=keyboard] selector. Confirm that the root element remains valid and that the output matches the expected selector, with stackableRoot appended rather than prepended.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.