Skip to content

Remove wrong placeholder-shown prefixing for Firefox#1545

Closed
timlg07 wants to merge 1 commit into
postcss:mainfrom
timlg07:patch-1
Closed

Remove wrong placeholder-shown prefixing for Firefox#1545
timlg07 wants to merge 1 commit into
postcss:mainfrom
timlg07:patch-1

Conversation

@timlg07
Copy link
Copy Markdown

@timlg07 timlg07 commented Feb 27, 2026

Replacing :placeholder-shown with :-moz-placeholder breaks in Firefox. While placeholder-shown is working fine (supported since Jan. 2017), the :-moz-placeholder added by autoprefixer breaks selectors with :not:

Example:

input[placeholder]:not(:placeholder-shown) ~ label {
    top: 16px;
    font-size: 12px;
}

produces:

.form .field .input input[placeholder]:not(:-moz-placeholder)~label,
.form .field .input input[placeholder]:not(:placeholder-shown)~label{
    top: 16px;
    font-size: 12px;
}

This always applies, even if the placeholder is shown, because :not(:-moz-placeholder) evaluates to true.

I couldn't find any resources stating that :-moz-placeholder behaves like :placeholder-shown, so I wonder why it's in here?

@ai
Copy link
Copy Markdown
Member

ai commented Feb 27, 2026

Have you just break all :-moz-placeholder?

I know about this problem, but we need careful solution.

I would like to accept PR, but I need from you to think about all edge cases.

@timlg07
Copy link
Copy Markdown
Author

timlg07 commented Feb 27, 2026

Do you know that it actually works in Firefox < 50? Because I couldn't find any proof for it. But even if it does, it should only be activated for Firefox < 50, as it's not needed in modern version and even breaks some selectors, like shown in my example🙈

@ai
Copy link
Copy Markdown
Member

ai commented Feb 27, 2026

Do you know that it actually works in Firefox < 50?

It is mark as supported in Can I Use

https://caniuse.com/?search=placeholder-shown

it should only be activated for Firefox < 50

We are adding it because of KaiOS 2.5 (FF based browser for cheap phones very popular in Afrika). It is part of default browser set.

@timlg07
Copy link
Copy Markdown
Author

timlg07 commented Feb 27, 2026

That explains why adding 'not Firefox < 51' to the browserlist had no effect. I adjusted my browserlist and it works now. So I guess this stays and is intended? Thank you for the fast response!

@timlg07 timlg07 closed this Feb 27, 2026
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