Skip to content

preset-base: emit WebKit backdrop-filter before the standard declaration #3668

Description

@BarrieLAJ

Description

The built-in backdropFilter utility emits the standards declaration before the WebKit fallback:

.example {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

That order is unsafe with Lightning CSS. Lightning CSS treats the declarations as equivalent during optimization and keeps the last one, producing WebKit-only CSS that does not work in current Chromium or Firefox:

.example{-webkit-backdrop-filter:blur(5px)}

This affects Panda consumers using Next.js with Turbopack, which always processes CSS through Lightning CSS. It is also documented in parcel-bundler/lightningcss#695.

Panda version

Reproduced with @pandacss/dev and @pandacss/preset-base 1.11.4.

Reproduction

css({ backdropFilter: 'blur(5px)' })

panda cssgen emits:

.bkdp_blur\\(5px\\) {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

With lightningcss@1.31.1:

import { transform } from 'lightningcss'

const code = Buffer.from(`
.example {
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
`)

console.log(transform({ filename: 'input.css', code, minify: true }).code.toString())
// .example{-webkit-backdrop-filter:blur(5px)}

Expected behavior

The prefixed fallback should be emitted first and the standards declaration last:

.example {
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

The backdropFilter utility transform in @pandacss/preset-base can accomplish this by reversing the returned property order:

return {
  WebkitBackdropFilter: value,
  backdropFilter: value,
}

This ordering survives Lightning CSS and preserves browser compatibility.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions