Skip to content

Prefix display flex and grid values regardless of case - #1582

Merged
ai merged 1 commit into
postcss:mainfrom
itisrmk:fix/display-flex-grid-case
Dec 3, 2026
Merged

ai merged 1 commit into
postcss:mainfrom
itisrmk:fix/display-flex-grid-case

Conversation

@itisrmk

@itisrmk itisrmk commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

CSS keywords are ASCII case-insensitive, but display values were only prefixed when written in lowercase, because DisplayFlex#check() and DisplayGrid#check() compared decl.value with ===. Removing outdated prefixes also failed next to an uppercase unprefixed value, because the remover looked for the lowercase name with a case-sensitive includes().

With overrideBrowserslist: ['Chrome 20', 'Firefox 20', 'IE 10'] and grid: 'autoplace':

Input CSS

a { display: FLEX }
b { display: Inline-Flex }
c { display: GRID }

Current output CSS

a { display: FLEX }
b { display: Inline-Flex }
c { display: GRID }

Output after the fix

a { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: FLEX }
b { display: -webkit-inline-box; display: -moz-inline-box; display: -ms-inline-flexbox; display: Inline-Flex }
c { display: -ms-GRID; display: GRID }

With overrideBrowserslist: ['Chrome 100'], a { display: -webkit-box; display: -ms-flexbox; display: FLEX } currently keeps display: -ms-flexbox; after the fix it becomes a { display: FLEX }.

Both new tests fail before the fix. pnpm test passes (291 tests, 100% line coverage, lint and size checks).

@ai
ai merged commit ee21bcd into postcss:main Dec 3, 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