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.
Comment | File | Size | Author |
---|---|---|---|
#50 | 2399247-50.patch | 16.64 KB | komalk |
#33 | 2399247-33.patch | 19.46 KB | lokapujya |
#27 | interdiff-15-25.txt | 2.89 MB | juhog |
#25 | investigate_font_size-2399247-25.patch | 19.66 KB | juhog |
#15 | investigate_font_size-2399247-15.patch | 20.14 KB | emma.maria |
Comments
Comment #1
DickJohnson CreditAttribution: DickJohnson commentedComment #2
DickJohnson CreditAttribution: DickJohnson commentedComment #3
DickJohnson CreditAttribution: DickJohnson commentedComment #4
emma.mariaHey 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
Comment #5
DickJohnson CreditAttribution: DickJohnson commentedSo, as our base-font is currently 87,5% (=14px for most users), our PX->EM convertion table looks like:
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.
Comment #6
Anonymous (not verified) CreditAttribution: Anonymous commentedComment #7
emma.mariaWe 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.
a H1 page title declaration...
and a .node__content font size declaration which affects the original H1 styling.
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.
Comment #8
emma.mariaComment #9
jibranTagging.
Comment #10
LewisNymanh1#page-title {
In Seven we just removed the page-title styling completely and made that the default h1 styling.
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?
Comment #11
joelpittet+1 to remove
.node__content { font-size: }
Comment #12
emma.mariaLet's do this!
Comment #13
emma.mariaFrom 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
Comment #14
emma.mariaPlanned 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.Comment #15
emma.mariaI 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 :)
Comment #16
RainbowArrayWhile 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.
Comment #17
joelpittet@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.
Comment #18
RainbowArrayAs 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.
Comment #19
emma.mariaI 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?
Comment #20
joelpittetI 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.
Comment #21
RainbowArrayWe could split off switching to rems to another issue.
Comment #22
LewisNymanI 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.
I think we should make this 16px and remove all instances of 15px.
Change to 12px
Change to 14px or 16px
Change to 12px
Change to 14px or 16px
Is this needed? What CSS is this overidding?
Make this 12px
Comment #23
emma.mariaComment #24
Bojhan CreditAttribution: Bojhan commentedCrazy 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?
Comment #25
juhog CreditAttribution: juhog at Druid commentedRerolled
My first reroll. There were some conflicts but I think I managed to solve them correctly.
Comment #26
mgiffordOk, 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.
Comment #27
juhog CreditAttribution: juhog at Druid commentedThat'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.
Comment #28
mgiffordThanks!
Comment #29
Bojhan CreditAttribution: Bojhan commentedComment #31
mgiffordComment #32
mgiffordDoes 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.
Comment #33
lokapujyacore/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.
Comment #34
lokapujyaNeeds 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?Comment #35
mgiffordComment #36
kattekrab CreditAttribution: kattekrab at Creative Contingencies commentedI 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.
Comment #37
xjmComment #38
lokapujyaComment #39
lokapujyaSo, 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.
Comment #40
emma.mariaWe 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!
Comment #41
emma.mariaComment #50
komalk CreditAttribution: komalk at Srijan | A Material+ Company for Drupal India Association commentedPatch #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.
Comment #56
smustgrave CreditAttribution: smustgrave at Mobomo commentedThis 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.