Skip to content

multiple nested selectors within :deep don't work with lightningcss #763

@brc-dd

Description

@brc-dd

Related plugins

Describe the bug

:deep(.foo) {
  &:hover,
  &:focus,
  &:focus-within {
    .bar {
      color: red;
    }
  }
}

when css.transformer is set to lightningcss, this is getting compiled to:

:is(:deep(.foo):hover,:deep(.foo):focus,:deep(.foo):focus-within) .bar[data-v-4089b056]{color:red}

with postcss:

:is([data-v-4089b056] .foo:hover,[data-v-4089b056] .foo:focus,[data-v-4089b056] .foo:focus-within) .bar{color:red}

Reproduction

https://stackblitz.com/edit/vitejs-vite-3kuur5ua?file=src/App.vue,vite.config.ts

Steps to reproduce

  1. Hover on the button in preview. The color doesn't change.
  2. Comment out transformer: 'lightningcss' in vite.config.ts and save.
  3. Hover on the button in preview. The color changes to red.

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 22.22.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.8.2 - /usr/local/bin/npm
    pnpm: 8.15.6 - /usr/local/bin/pnpm
  npmPackages:
    @vitejs/plugin-vue: ^6.0.5 => 6.0.6 
    vite: ^8.0.8 => 8.0.8

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingbug: upstreamBug in a dependency of this repositoryp3-minor-bug 🔨An edge case that only affects very specific usage (priority)

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions