Skip to content

Selecting ::details-content::before pseudo element errors #1244

@james-nash

Description

@james-nash

I have some CSS that targets a ::before pseudo element of the <details> element's ::details-content using a selector containing ::details-content::before. It seems to be supported in the major browsers (current versions of Firefox, Safari & Chrome parse and apply those styles - see screenshots below) so I presume this is valid CSS, however lightningcss errors with "Invalid state" when it encounters that.

You can reproduce this in the Lightning CSS Playground with the following code:

::details-content::before {
  background-color: red;
}
Image

Given that browsers accept this selector, I think Lightning CSS should be able to handle it and not error, so I think this is a bug.


As promised above, here a screenshot of the various browser dev tools showing this selector working fine:

Firefox (v150)
Image

Chrome (v148)
Image

Safari (v26.4)
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions