Consistency is important for theming, for accessibility & UX. Bartik has some outstanding theme issues that need to be cleaned up.

Why this should be an RC target

With consistent font sizes we can ensure that low vision users are able to see the smallest font sizes and that if they need to re-size the page that the different elements increase in a reasonable way.

---

While investigating Bartik CSS in several different issues, I started to feel like many different font-size values were being used in the theme. After taking a look here were the values I found:

Font-size value 	Where it's being used
87,50%	body
3em	blockquote:before
	blockquote:after
2em	h1#page-title
1.821em	#site-name, .site-name (media.css)
1.714em	#triptych h2 (media.css)
1.643em	#featured (media.css)
1.6em	#site-name, .site-name (header.css)
1.429em	#content h2
1.4em	#triptych h2 (triptych.css)
1.357em	h1
1.2em	#featured
	        #featured h2
1.174em	#featured h2 (media.css)
1.143em	h2
1.142857143em	input, textarea (media.css)
1.092em	h3
1.083em	#forum .name
1.071em	.comment .submitted p
	.node__content
	.sidebar h2
1.05em	h4
1em	.node--view-mode-teaser .node__content
	#footer-columns h2
	#forum .description
	#block-search-form .form-item-search-block-form input
	table table
	#footer-wrapper table
0.94em	.skip-link,
	        .skip-link:link,
	        .skip-link:visited
0.929em	.breadcrumb
	.button
	.comment .content
	input, textarea
	.form-item label
	.comment-form label
	#site-slogan, .site-slogan
	.pager__item
	.region-primary-menu .menu
	body:not(:target) .region-primary-menu .menu-toggle {
	.region-secondary-menu .menu
	.tabs ul.primary li a
0.923em	.contextual-region .contextual .contextual-links a
0.916em	.region-header #block-user-login div.item-list
	        .region-header #block-user-login div.description
0.914em	.sidebar .block .content
0.9em	.node-preview-backlink (content.css)
	        .node-preview-backlink (node-preview.css)
0.889em	h5
0.857em	.node__meta
	        #footer-wrapper .block .content
	       .filter-help a
	       .region-header .block
0.821em	.node--view-mode-teaser .field-type-taxonomy-term-reference .field-label
	        .node--view-mode-teaser .field-type-taxonomy-term-reference ul.links
	        ul.links
0.8em	 .field-type-taxonomy-term-reference .field-label, .field-type-taxonomy-term-reference ul.links
0.786em	.comment .submitted .comment-time
	.comment .submitted .comment-permalink
	.comment-form .form-item .description
	.comment-form details.filter-wrapper .tips
0.67em	h6
0.55em	#featured .demo-block
90%	.demo-block
	.maintenance-page #name-and-slogan
120%	#highlighted
small	.caption > figcaption
	.caption
smaller	.views-displays .secondary a
	        .views-displays .secondary input.form-submit
13px	        .views-display-column details summary

Proposed resolution

Talk and decide which font-sizes we should actually use.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DickJohnson’s picture

Issue summary: View changes
DickJohnson’s picture

Issue summary: View changes
DickJohnson’s picture

Issue summary: View changes
emma.maria’s picture

Issue tags: +frontend, +CSS

Hey thanks for this.

I think we should try and strip out some of these on a case per case basis. There must be some cases where we can simplify the font size declarations and selectors that use them.

There is also another issue to do with font sizes and accessibility to be aware of here #2247319: Improve visibility of Bartik's smallest font elements.

+Adding tags

DickJohnson’s picture

So, as our base-font is currently 87,5% (=14px for most users), our PX->EM convertion table looks like:

10px	 0.714em	71.4%	8pt
11px	 0.786em	78.6%	8pt
12px	 0.857em	85.7%	9pt
13px	 0.929em	92.9%	10pt
14px 1.000em	100.0%	11pt
15px	 1.071em	107.1%	11pt
16px	 1.143em	114.3%	12pt
17px	 1.214em	121.4%	13pt
18px	 1.286em	128.6%	14pt
19px 1.357em	135.7%	14pt
20px 1.429em	142.9%	15pt
21px	 1.500em	150.0%	16pt
22px	 1.571em	157.1%	17pt
23px 1.643em	164.3%	17pt
24px 1.714em	171.4%	18pt

Between 0.857em and 1.071em (which looks normally like 12-15px) we have about 15 different font-sizes, so my suggestion is to start by changing everything between 0.821em and below 0.9em to 0.857em, 0.9-0.94em to 0.929em. 1.05em should be changed to 1em. 1.083em and 1.092em to 1.071em.

Anonymous’s picture

Issue summary: View changes
Issue tags: +font-size
emma.maria’s picture

Issue summary: View changes
FileSize
170.22 KB

We need to tackle the issue of .node__content declaring a font size of 1.071em to every element it contains.

This is causing the following problems:

We moved around how content is printed in the node template and this has caused font size problems in this issue. Which we were forced to add a quick fix to deal with it for now.
#2455211: Comment field displayed last regardless of assigned weight

I have also noticed that we have:

a H1 font size declaration.

h1, .heading-a {
  font-size: 1.357em;
  ...
}

a H1 page title declaration...

h1#page-title {
  font-size: 2em;
  ...
}

and a .node__content font size declaration which affects the original H1 styling.

.node__content {
  font-size: 1.071em;
}

So we have this visual problem in nodes to do with H1 headings right now as demonstrated below...

 

 

There should be one
declaration in Bartik that is not affected by anything else to keep h1's always at the same size.

emma.maria’s picture

Issue tags: +drupaldevdays
jibran’s picture

LewisNyman’s picture

h1#page-title {
In Seven we just removed the page-title styling completely and made that the default h1 styling.

.node__content {
  font-size: 1.071em;
}

It's causes loads of problems if you change the font size on a wrapper as it has loads of unexpected consequences on the elements inside, does anyone know why do we do this?

joelpittet’s picture

+1 to remove .node__content { font-size: }

emma.maria’s picture

Assigned: Unassigned » emma.maria

Let's do this!

emma.maria’s picture

From inspecting the calculated values in the browser, here are the calculated px sizes and the components that use them.

Base elements

html: 14px
h1 : 19px
h2 : 16px
h3 : 15px
h4 : 14px
h5 : 12px
h6 : 9px

Modified node content base sizes (because of .node__content declared em size)

p : 15px
h1 : 30px
h2 : 21.4264px
h3 : 16.058px
h4 : 15.743px
h5 : 12.8499 px
h6 : 9.6412 px

Specific font sizes set in the CSS

11px

comment__time
comment__permalink
comment-form .filter-wrapper .tips

12px

node__meta
region-header block
ul.links
comment links li
field--type-entity-reference field-label (tags)
field--type-entity-reference ul.links (tags)
filter-help a
forum-description
site-footer content
site-footer table

13px

region-primary-menu menu
region-secondary-menu menu
pager__item
sidebar block content
breadcrumb
comment__context
demo-block
input, textarea (for desktop)
form-item label
forum-name
site-slogan
search-form input
table
skip-link
tabs ul.primary li a
ui-dialog input
ui-dialog button
views-display-column details summary
maintenance-page name-and-slogan

14px

node--view-mode-teaser node__content
site-footer h2

15px

comment__meta
comment__content h3
node__content
sidebar h2

16px

input, textarea (for mobile)

20px

featured-bottom h2
featured-top h2
main-content h2

28px

page-title

emma.maria’s picture

Planned changes:

Base styles:

body: 13px (as it has the most declarations)
h1 : 28px
h2: 20px
h3: 15px
h4: 14px (it currently rounds up to 15px and has the same styles as the h3)
h5: 12px
h6 : 9px

This will cut down a huge amount of font declarations.

As we are removing the font declaration on node__content class I will add a bunch of node__content h2, node__content h3 etc classes to put the font sizes back to the weird originals they currently have. Resizing these (and causing very obvious visual changes) can be further discussed.

emma.maria’s picture

Assigned: emma.maria » Unassigned
Status: Active » Needs review
FileSize
20.14 KB

I made a start with this. I rounded any strange font sizes that to help them fit the base sizes and I removed a lot of font size declarations.

I haven't touched the .node__content class yet. The font sizes as a result of font-size: 1.071em give such strange font sizes which should not be set as the base font sizes.

Those font sizes are:
p : 15px
h1 : 30px
h2 : 21.4264px
h3 : 16.058px
h4 : 15.743px
h5 : 12.8499px
h6 : 9.6412px

Any advice on what to do with them, the base font size of 13px which fits in with the rest of the site is very different.

There are now 43 declarations of font sizes instead of 57.

Also I left comments of the calculated pixel sizes next to all of the font-size declarations to help out, these need to be eventually removed but it took me hours to work everything out :)

RainbowArray’s picture

While we're at it, would it be worth converting these to rems? That would help prevent problems if font sizes get set on any wrappers in the future.

joelpittet’s picture

@mdrummond http://caniuse.com/#feat=rem There could be some gotcha's I wonder if we'd then have to double them up for IE9-11 BC.

RainbowArray’s picture

As long as we're not using rem in font short-hand, it's fine for IE9 and IE10. So as long as they're declared with font-size, no problem.

emma.maria’s picture

I see no problem adding rems. I thought the easiest way without bike shedding the use of rems in Core was to overhaul what was going on with ems.

Also can someone please advise me on the predicament I mentioned in #15?

The node__content font-size declaration guarantees that everything in that wrapper is set to a base of 15px. Which does not match any of the other content on the site. Do we keep this as is? Or declare font sizes for any possible text component within node__content?

joelpittet’s picture

I recommend setting the body size to 15px and removing the node__content size declaration.

The majority content is using that as base. Other regions can undo that if they need to.

RainbowArray’s picture

We could split off switching to rems to another issue.

LewisNyman’s picture

I think I understand the idea behind .node__content but I think it's really odd logic. A node could appear anywhere, in the footer, sidebar, etc. I think it's just a simplistic idea of a node always being a full page.

I tried to go through and figure out where we can reduce the number of font sizes we have. There are too many that are only a pixel apart.

  1. +++ b/core/themes/bartik/css/base/elements.css
    @@ -43,32 +43,33 @@ h1,
    -  font-size: 1.092em;
    +  font-size: 1.154em; /* 15px */
    

    I think we should make this 16px and remove all instances of 15px.

  2. +++ b/core/themes/bartik/css/components/breadcrumb.css
    @@ -5,5 +5,5 @@
    -  font-size: 0.929em;
    +/*  font-size: 0.929em; /* 13px */
    

    Change to 12px

  3. +++ b/core/themes/bartik/css/components/comments.css
    @@ -39,17 +38,18 @@
       line-height: 1.2;
    +  font-size: 1.154em; /* 15px */
    

    Change to 14px or 16px

  4. +++ b/core/themes/bartik/css/components/comments.css
    @@ -39,17 +38,18 @@
    -  font-size: 0.733em;
    +  font-size: 0.846em; /* 11px */
    ...
    -  font-size: 0.733em;
    +  font-size: 0.846em; /* 11px */
    

    Change to 12px

  5. +++ b/core/themes/bartik/css/components/sidebar.css
    @@ -50,11 +50,10 @@
    -  font-size: 1.071em;
    +  font-size: 1.154em; /* 15px */
    

    Change to 14px or 16px

  6. +++ b/core/themes/bartik/css/components/table.css
    @@ -73,7 +73,7 @@ tr th {
    -  font-size: 1em;
    +  font-size: 1em; /* matches default table content 12.8498582839966px */
    

    Is this needed? What CSS is this overidding?

  7. +++ b/core/themes/bartik/css/components/ui-dialog.css
    @@ -26,7 +26,7 @@
    -  font-size: 0.929em;
    +  font-size: 0.909em; /* 13px */
    

    Make this 12px

emma.maria’s picture

Issue tags: +Needs usability review
Bojhan’s picture

Crazy question but have we looked at the baseline and looked at what our multiplier is that will give us an understanding of how to treat the node body?

juhog’s picture

Rerolled

My first reroll. There were some conflicts but I think I managed to solve them correctly.

mgifford’s picture

Ok, so this is just a reroll from #15, without the feedback from #22, right?

Interdiff's are always great.

Good to wait to move rem (root em) units to another issue.

juhog’s picture

FileSize
2.89 MB

That's correct, #25 was a reroll from #15. Here's the interdiff (I hope I got it right).

I'll start working on the actual issue now.

mgifford’s picture

Thanks!

Bojhan’s picture

Issue tags: -Needs usability review

mgifford’s picture

Issue tags: +Needs reroll, +Accessibility
mgifford’s picture

Does this need the <h3>Why this should be an RC target</h3> info & RC phase evaluation table? Also there's the "rc target triage" tag.

I'd like this in for the 8.0 release for sure.

lokapujya’s picture

Issue tags: -Needs reroll
FileSize
19.46 KB

core/themes/bartik/css/components/form.css
<<<<<<< HEAD
font-size: 16px;
=======
font-size: 1.142857143em; /* TODO 16px */
>>>>>>> 25

Just a reroll for now.

Keeping the px here per https://www.drupal.org/node/2516918 Prevent mobile browsers from zooming on all form inputs.

lokapujya’s picture

Needs issue summary update
Are we doing #22 in order to not have as many different font sizes? Setting the body size to 15px sounded good. But, is #22 saying that we should keep .node__content because the node could be put into any region?

mgifford’s picture

Issue summary: View changes
Issue tags: -Needs beta evaluation +rc target triage
kattekrab’s picture

Title: Investigate font-size consistency in Bartik » Reduce number of different font-sizes in Bartik for better consistency

I reckon we should change the issue title because "Investigate font-size" doesn't sound actionable.

Changing title from Investigate font-size consistency in Bartik
to Reduce number of different font-sizes in Bartik for better consistency

Issue summary should also briefly outline what is changing.

Have the comments from #22 been addressed in the latest patch?

Is there consensus about what to do with .node__content ? I can't tell from the discussion.

I wonder if @LewisNyman and @emma.maria should revisit this and provide some extra clarity?

We're running out of time to get this in for 8.0.

xjm’s picture

Issue tags: -rc target triage
lokapujya’s picture

Issue tags: -drupaldevdays +Bartik
lokapujya’s picture

Status: Needs review » Needs work
Issue tags: +Needs reroll

So, we CAN still do this! Bartik is not frozen.

Someone can work on:
Needs reroll + tackle comments in #22.

If you know what to do about .node__content you can work on that too, or that can be done after we have consensus.

emma.maria’s picture

Version: 8.0.x-dev » 8.2.x-dev
Category: Task » Plan
Issue tags: -Needs reroll +Usability

We definitely can do this monster of an issue!

However this needs to be set to a 'Plan' first. This is because of the amount time this issue has been left + the range of opinions + the requests for consensus on the way forward.

Yay font size headache!

emma.maria’s picture

Status: Needs work » Active

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

komalk’s picture

Status: Active » Needs review
FileSize
16.64 KB

Patch #33 is failed to apply to 9.1x.
Work on the comments in #22.
https://www.drupal.org/project/drupal/issues/2399247#comment-10281061
Here is the fixed review patch.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

smustgrave’s picture

Project: Drupal core » Bartik
Version: 10.1.x-dev » 1.0.2
Component: Bartik theme » Look and Feel
Status: Needs review » Needs work

This appears to be a bartik only issue. And since bartik has been removed from core in D10 moving to the contrib module.

Also moving to NW as there is a needs IS update.