question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

What are you trying to do?

Hi all!

tl;dr;

Is :label-shown preudo-class used in form-field component necessary / valid? (e.g. https://github.com/angular/components/blob/master/src/material/form-field/_form-field-fill-theme.scss#L100)

Problem background

I’m trying to use polyfill for paged media (https://www.pagedmedia.org/paged-js/) in combination with "@angular/material": "12.2.4" and it complains about :

Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': '.mat-form-field-can-float .mat-input-server[label]:not(:label-shown)+.mat-form-field-label-wrapper .mat-form-field-label' is not a valid selector. at <anonymous>:1:10

Breaking it down, the only breaking part in selector is pseudo-selector “:label-shown” about which existence I’ve never heard of anywhere else.

What troubleshooting steps have you tried?

I’ve tried to filter out css styles used in my application, problem emerges when mat.core mixin is in place.

Reproduction

Steps to reproduce:

  1. check https://stackblitz.com/edit/angular-ivy-24s2x2?file=src/app/app.component.scss
  2. comment / uncomment mat.core in app.component.scss

Environment

  • Angular: 12.1.2
  • CDK/Material: 12.2.4
  • Browser(s): Google Chrome Version 96.0.4664.110 (Official Build) (64-bit)
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10 Pro

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
crisbetocommented, Jan 10, 2022

Okay, I think I figured out what happened. We used to have :placeholder-shown in there which is an actual pseudo selector. When we changed the label/placeholder terminology in #8223, it was renamed and we didn’t notice it until now.

0reactions
angular-automatic-lock-bot[bot]commented, Oct 2, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Form field - Angular Material
The floating label is a text label displayed on top of the form field control ... The label for a form field can...
Read more >
Angular mat-form-field input & label - Stack Overflow
I would like to have the label on the left and a text input field on the right. How can I do this?...
Read more >
<mat-label> in Angular Material - GeeksforGeeks
First, install the angular material using the above-mentioned command. · After completing the installation, Import 'MatFormFieldModule' from '@ ...
Read more >
Form field appearance variants - StackBlitz
<mat-label>Legacy form field</mat-label>. <input matInput placeholder="Placeholder">. <mat-icon. matSuffix>sentiment_very_satisfied</. mat-icon>.
Read more >
An Introduction to Angular Material Form-Fields - Medium
To show that other controls can have Prefixes or Suffixes and not just input elements. In this example, we have a mat-select and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found