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.

Material buttons do not allowed a font-weight overwrite

See original GitHub issue

Bug

MatButtonModule

What is the expected behaviour?

when being specific with a css class or when using inline styling a Matbutton should allow a overwrite of the styling on the * { font-weight: 300 }

What is the current behaviour?

font-weight is not being overwritten on the matButtons when using a class or inline styling when a asterisk/universal selector with font-weight is used on everything.

What are the steps to reproduce?

using a * selector to target every font-weight on all the pages and then trying to change the mat button with a class or inline styling see https://stackblitz.com/edit/angular-2nryr7

What is the use-case or motivation for changing an existing behaviour?

Trying to change the font-weight on the text inside the material button

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular & Angular material version 7.0.1

Google Chrome build 70.0.3538.77 (64-bit) Firefox Quantum 63.0.2 (64-bit) Microsoft Edge 42.17134.1.0 (64-bit) Opera 56.0.3051.52 (64-bit)

Microsoft Windows Prof 64 bit

Is there anything else we should know?

As shown in the stackblitz page the overwriting of the styling works as it should on the normal button and on other elements like paragraph.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
crisbetocommented, Oct 29, 2018

@justixnl you can’t see the font-weight in your example because of view encapsulation. Here’s a working fork: https://stackblitz.com/edit/angular-dy2bsj.

1reaction
Mastermindzhcommented, Oct 29, 2018

The selectors work fine, the example demonstrates that the selectors work on regular buttons/elements but not on material buttons.

It only fails when you add the material classes/directives (e.g mat-raised-button).

Try adding “mat-raised-button” to the regular, working, button and you can see it fail for yourself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Material buttons do not allowed a font-weight overwrite #13824
font-weight is not being overwritten on the matButtons when using a class or inline styling when a asterisk/universal selector with font-weight ...
Read more >
Customizing Typography - Angular Material
Each level includes styles for font family, font weight, font size, and letter spacing. Angular Material uses the typography levels from the 2018...
Read more >
How to change font-weight of label - Stack Overflow
I would like to change style of angular material design component. In .scss file I override cascade style but only 'font-weight' property is...
Read more >
Typography - MUI System
Documentation and examples for common text utilities to control alignment, wrapping, weight, and more.
Read more >
TextBlock.FontWeight Property (System.Windows.Controls)
A member of the FontWeights class specifying the desired font weight. The default is determined by the MessageFontWeight value. Examples. The following example ......
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