Skip to content

Conversation

@martin-havala
Copy link

fix(material/form-field) : correct placeholder-shown pseudo class

Replace an invalid pseudo class :label-shown by a valid :placeholder-shown pseudo class to correct styles of a form-field label

Fixes #24181

fix(material/form-field) : correct placeholder-shown pseudo class

Replace an invalid pseudo class `:label-shown` for a valid `:placeholder-shown` to correct styles of a form-field label

Fixes #24181
// Server-side rendered matInput with a label attribute but label not shown
// (used as a pure CSS stand-in for mat-form-field-should-float).
.mat-input-server[label]:not(:label-shown) + .mat-form-field-label-wrapper
.mat-input-server[label]:not(:placeholder-shown) + .mat-form-field-label-wrapper
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove all the :not(:placeholder-shown) usages altogether. The recommended approach for labelling inputs has been using mat-label for a long time now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we just remove all these rules then? I guess they should not work anyway (see my tiny copen)

Nevertheless, couldn't we just fix the obvious bug(reverting the pseudo-selector) and handle any further optimizations afterwards?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather keep the selectors without the :not. It's possible that this was a regression the entire time, but we never noticed it.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mat-form-field: ":label-shown" pseudoclass

2 participants