Opened on 02/16/2018 at 04:41:28 PM

Closed on 02/26/2018 at 03:28:45 PM

#6400 closed change (fixed)

Adapt CSS coding style to enforce numerical values for font-weight

Reported by: greiner Assignee: juliandoucette
Priority: P3 Milestone:
Module: Websites Keywords: goodfirstbug
Cc: ire, juliandoucette, saroyanm, agiammarchi, erikvold Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

Description (last modified by juliandoucette)

Background

We are consistently writing CSS font weight values in their numerical rather than their named notation to (a) avoid mixing both together and thereby accidentally specifying a value that the font was not assigned to and (b) achieve the maximum flexibility when choosing a value.

What to change

"font-weight-notation": ["numeric", {
    "ignore": ["relative"]
}]

Attachments (0)

Change History (11)

comment:1 Changed on 02/17/2018 at 04:58:08 AM by juliandoucette

How does this "achieve the maximum flexibility when choosing a value."?

We chose to use relative named values (e.g. bold, bolder) in website-defaults so that (e.g. strong) tags would appear appropriately bolder when placed in light (e.g. eyeo.com) or already bold/semibold (e.g. heading) text.

Last edited on 02/17/2018 at 04:58:46 AM by juliandoucette

comment:2 Changed on 02/19/2018 at 08:28:19 AM by ire

I think a distinction should be made between the "static" keyword values (normal and bold) and the relative keyword values (lighter and bolder).

The static keyword values are just alternatives for the numeric notation, i.e. normal is always equivalent to 400. In those cases, I think we can agree that we always prefer to use the numeric notation.

For the relative keyword values, as Julian mentioned, we have found use for them in website-defaults because in some cases we want a font weight to be bolder/lighter than it's surrounding context, not a specific number.

So I suggest, in our stylelint & coding rules, we allow for the relative named keywords.

"font-weight-notation": ["numeric", {
    "ignore": ["relative"]
}]

See https://stylelint.io/user-guide/rules/font-weight-notation/

comment:3 Changed on 02/19/2018 at 02:20:34 PM by greiner

  • Description modified (diff)

I wasn't sure whether you actually need lighter and bolder so I'm glad that you're bringing it up. Thanks.

How does this "achieve the maximum flexibility when choosing a value."?

My thinking was that the numberical notation allows us to choose from all possible font weights rather than merely from normal=400 and bold=700.

So I suggest, in our stylelint & coding rules, we allow for the relative named keywords.

No objections. I updated the ticket description to reflect that.

comment:4 follow-up: Changed on 02/19/2018 at 03:53:16 PM by juliandoucette

LGTM.

Detail: I would not be against using named variables for weights in SCSS. e.g. $normal where $normal = 400 and can be changed globally or contextually.

comment:5 in reply to: ↑ 4 Changed on 02/19/2018 at 04:01:00 PM by greiner

Replying to juliandoucette:

Detail: I would not be against using named variables for weights in SCSS. e.g. $normal where $normal = 400 and can be changed globally or contextually.

Agreed, same goes for using CSS variables as soon as we start using them in our code.

comment:6 Changed on 02/21/2018 at 04:17:52 PM by juliandoucette

  • Priority changed from Unknown to P3
  • Ready set

comment:7 Changed on 02/21/2018 at 04:18:58 PM by juliandoucette

  • Description modified (diff)
  • Keywords goodfirstbug added

comment:8 Changed on 02/26/2018 at 03:14:18 PM by juliandoucette

  • Owner set to juliandoucette

comment:9 Changed on 02/26/2018 at 03:22:08 PM by abpbot

comment:10 Changed on 02/26/2018 at 03:26:28 PM by abpbot

comment:11 Changed on 02/26/2018 at 03:28:45 PM by juliandoucette

  • Resolution set to fixed
  • Status changed from new to closed

Sorry about the mixed commit lines :(

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from juliandoucette.
 
Note: See TracTickets for help on using tickets.