-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
:placeholder-shown is replaced with -moz-placeholder, although this is outdated #1533
Comments
Can you show simple example of input CSS, output and expected output? |
https://caniuse.com/?search=placeholder-shown says that Also, another argument is that But we may be wrong. Please show your proofs or arguments. |
Yes, but that's only true for Firefox prior v50. Modern Firefoxes support Here is a minimal example: show the label only if the placeholder is visible: HTML: CSS: In retrospective, I could have achieved the same effect with
I appreciate your great work, that's only a little annoyance. :) |
Oh, so you have a problem only with Can you show current output and expected output (with prefixes)? |
Here it still works: the search field at the top has a label "what are you looking for" that disappears, when the input receives focus. Also the reset button (the x) only appears when there is text in the input. https://verwaltung.bund.de/portal/EN The negative case only appears on dev stages so far. |
|
Okay, I made a fiddle: https://codepen.io/kliehm/pen/ZYExNdd With a current Firefox you can see that :placeholder-shown is not equivalent to :-moz-placeholder. So in current versions of Firefox autoprefixer shouldn't replace it. I didn't succeed to include different versions of autoprefixer in the fiddle, so I made it static. My apologies that I'm not able to pin it down further, if it's a problem with autoprefixer or browserslist. I don't think it's a change in Firefox, since in version 10.4.21 of autoprefixer it gets replaced with :-moz-placeholder, whereas in version 10.4.20 it didn't. |
I see that Firefox and Chroma output is exactly the same. |
Okay, sorry for the inconvenience. This is my output on Firefox v136.0.2 (Windows). It's interesting that your browser is interpreting the second part exactly opposite from the expected behavior of :-moz-placeholder. I can reproduce your screenshot with Chrome 134.0.6998.89. The expected behavior is the top two examples with :placeholder-shown, same as your result. The bottom two examples with :-moz-placeholder show that it's not the same result as :placeholder-shown. Although you get different results, you can see that it's not equivalent. |
@Marukome0743 I could pin it down: it worked with autoprefixer 10.4.20, was broken with autoprefixer 10.4.21. It is this commit. The problem is that caniuse lists the replacement with |
Explanation of bugTL;DR: The support of Kaios 2.5 I finally found out the cause of this issue. First, Autoprefixer don't add the Second, Autoprefixer appends the Third, I checked the target browsers of the Lines 484 to 493 in 541295c
|
Thank you for your research. I'm afraid solution #2 doesn't work. According to our Browserslist configuration, KaiOS should be excluded:
Other browsers and OS have a current market share in Germany of < 0.2% (KaiOS doesn't even appear in stats after 2018), so it shouldn't be included. If that configuration doesn't work, I'd prefer solution #3. |
Good point, I'm not an expert either. I will try that. |
Eventually, I got the corrent
I also paste the result of your previous one to compare easily.
This |
I tried your suggestion
and it works. So for me that's fine. Thank you for the kind conversation and help. |
Due to a change in autoprefixer in the last two weeks I assume, suddenly
:placeholder-shown
is replaced with:-moz-placeholder
. According to caniuse, this should only be necessary in Firefox < 50, not in current versions.Although as far as I understand,
:-moz-placeholder
should be a synonym to::placeholder
, i.e. to style the placeholder, whereas:placeholder-shown
is an indicator if the placeholder is visible or not. So if the focus is within the input and the placeholder text disappears,:placeholder-shown
is false. That's something different than styling the placeholder.Our
.browserslistrc
looks like this, so Firefox < 50 should not be relevant:For the time being, I disabled replacement of
:placeholder-shown
with/* autoprefixer: ignore next */
.The text was updated successfully, but these errors were encountered: