Skip to content

autoprefixer incorrectly expands text-decoration with redundant vendor-prefixed and duplicate declarations #1541

@lukhanina

Description

@lukhanina

Bug Description
When processing CSS, autoprefixer converts a clean text-decoration shorthand into multiple redundant declarations, including unnecessary -webkit-text-decoration lines and duplicated text-decoration: underline. This bloats the output, obscures intent, and provides no compatibility benefit in modern browsers.

Input CSS

abbr[title] {
  border-bottom: none; /* 1 */
  text-decoration: underline; /* 2 */
  text-decoration: underline dotted; /* 2 */
}

Output CSS (Actual)

abbr[title] {
  border-bottom: none; /* 1 */
  -webkit-text-decoration: underline;
  text-decoration: underline; /* 2 */
  text-decoration: underline;
  -webkit-text-decoration: underline dotted;
          text-decoration: underline dotted; /* 2 */
}

Impact
Increases bundle size and reduces readability.
Misleads about required browser support.
Obscures intended progressive enhancement and makes diffs/noise in code review.

Link to Minimal Reproduction and step to reproduce
Configure a project with postcss-preset-env (default setup; no legacy prefixes needed)*.

abbr[title] {
  border-bottom: none; /* 1 */
  text-decoration: underline; /* 2 */
  text-decoration: underline dotted; /* 2 */
}

Add the input CSS (above) to a stylesheet.
Build the project and inspect the processed CSS output.
Observe redundant prefixed and duplicated declarations in the abbr[title] block

Expected Behavior
autoprefixer should preserve a minimal, standards-compliant output:

abbr[title] {
	border-bottom: none; /* 1 */
	text-decoration: underline; /* 2 */
	-webkit-text-decoration: underline dotted;
	        text-decoration: underline dotted; /* 2 */
}

No vendor-prefixed -webkit-text-decoration, as modern browsers support the unprefixed shorthand.
No duplicated text-decoration: underline;.
Progressive enhancement remains clear: fallback underline → dotted underline where supported.

Actual Behavior
Adds -webkit-text-decoration lines (obsolete for modern engines).
Duplicates text-decoration: underline;.
Produces noisy CSS that complicates reviews and maintenance without improving compatibility.

Environment
Tooling: autoprefixer (10.4.23) from default or typical PostCSS plugins (postcss-preset-env version 11.1.2).
Browsers: Chrome/Edge (Chromium), Safari, Firefox (modern versions).
OS: Any.
Webpack: 5.96.1

Is this a regression?
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions