Skip to content

Do not prefix declarations inside @supports with supports: false - #1569

Merged
ai merged 1 commit into
postcss:mainfrom
Ultroncn:fix/supports-false-inside-supports
Nov 19, 2026
Merged

ai merged 1 commit into
postcss:mainfrom
Ultroncn:fix/supports-false-inside-supports

Conversation

@Ultroncn

Copy link
Copy Markdown
Contributor

Hi! This addresses #1266.

With supports: false, Autoprefixer already skipped prefixing the @supports condition itself, but declarations inside the block were still prefixed. For example, @supports (position: sticky) { position: sticky } still produced position: -webkit-sticky for old browsers — yet that block only ever runs in browsers that already pass the feature query, so the prefixed declaration inside is dead code.

This change skips both property and value prefixing for declarations nested inside an @supports block when supports: false, leaving selector prefixing, prefix removal and warnings untouched. The README description of the option is updated to match.

Tests: 4 new cases in test/autoprefixer.test.js (inside-block value/property prefixing skipped, nested @media > @supports skipped, default behaviour still prefixes, outside-block declarations still prefixed). pnpm run unit passes 287/287 and lint is clean.

Please let me know if you'd rather keep the old behaviour — happy to adjust.

Declarations inside an @supports block are only applied by browsers which already pass the feature query, so prefixes there would never be used. With supports: false Autoprefixer now leaves those declarations untouched, while the default behaviour is unchanged.

Fixes #1266
@ai

ai commented Nov 19, 2026

Copy link
Copy Markdown
Member

Can you show an example: input, now, with-this-pr?

@Ultroncn

Copy link
Copy Markdown
Contributor Author

Sure. I ran the same CSS with { supports: false, overrideBrowserslist: ['Safari 8'] } on the base branch and this PR.

Input

@supports (position: sticky) {
  .item {
    position: sticky;
  }
}

Current output

@supports (position: sticky) {
  .item {
    position: -webkit-sticky;
    position: sticky;
  }
}

With this PR

@supports (position: sticky) {
  .item {
    position: sticky;
  }
}

The @supports condition stays the same in both outputs. The difference is the extra position: -webkit-sticky declaration inside the block.

@ai
ai merged commit cbeabf7 into postcss:main Nov 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants