Repository navigation
pseudo-states addon: CSS syntax error with child combinator followed by pseudo-class #35317
Unanswered
DmitriiKholodov
asked this question in
General
Replies: 2 comments
|
This issue has already been fixed in PR #35060, which was merged on June 5, 2026. The fix is very similar to your proposed solution — it detects combinators ( .replace(/([>+~])\s*(?=$|[,)])/g, '$1 *')This handles your exact case: Please upgrade to a Storybook version that includes this fix and retest. If you're on To reply, just mention @dosu. Docs are dead. Just use Dosu. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description
The
storybook-addon-pseudo-statesaddon generates invalid CSS selectors when processing rules where a pseudo-class follows a child combinator (>).Error
SyntaxError: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule '.ck.ck-list .ck-list__item > :focus, .ck.ck-list .ck-list__item > .pseudo-focus, .pseudo-focus-all .ck.ck-list
.ck-list__item > { z-index: var(--ck-z-default); position: relative; }'
Root Cause
In
extractPseudoStatesfunction (chunk-HWG5K276.js, line 71), when a selector like.ck.ck-list .ck-list__item > :focusis processed::focuspseudo-class is removed, leaving.ck.ck-list .ck-list__item >(trailing space after>).pseudo-focus-allis prepended.pseudo-focus-all .ck.ck-list .ck-list__item >- invalid CSS (nothing after child combinator)Affected Code
Proposed Fix
Add .replace(/\s*>\s*$/, " > *") to handle trailing child combinators by adding the universal selector *:
Environment
Reproduction
This occurs when Storybook loads CKEditor 5 CSS which contains selectors with child combinators followed by pseudo-classes.
All reactions