Problem/Motivation

Bartik's code needs to meet current Drupal coding standards.

The current typography.css file does not meet with Drupal's CSS file organisation standards - see here.

Proposed resolution

The styles within the typography.css file should be put into either elements.css if they are base element styles for Bartik or if they are specific to a component they are to moved into in the relevant component file they belong to.

Specific CSS cleanup tasks which should also be followed when cleaning up the CSS are outlined in #1342054: [META] Clean up templates and CSS.

Remaining tasks

  • Write a patch
  • Review the patch - code review and visual changes
  • Upload screenshots to show nothing/something is broken on the frontend

User interface changes

None, we are cleaning up CSS and markup in templates. The use of Bartik's UI and design will stay the same.

API changes

n/a

Beta phase evaluation

Reference: https://www.drupal.org/core/beta-changes
Issue category Task because it is a code clean up overhaul of a theme.
Unfrozen changes Unfrozen because it only refactors CSS and templates, no changes to UI or APIs
Prioritized changes The main goal of this issue is usability and performance. We want Bartik code to be up to date and something to be proud of.
Disruption No disruption it's only refactoring code not changing how to use the theme
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

emma.maria’s picture

Title: Clean up typography code in Bartik » Clean up "typography" CSS in Bartik
emma.maria’s picture

Title: Clean up "typography" CSS in Bartik » Remove the "typography" CSS file in Bartik
Issue summary: View changes
emma.maria’s picture

zealfire’s picture

From what i could best understand from this link(https://www.drupal.org/node/1887922),i think putting content of typography file in element.css file would be fine idea.But since i am new to codebase of drupal will it be fine to make changes in file of element.css in this manner:
body{
previous content remains same only this is additionaly added:font-family: Georgia, "Times New Roman", Times, serif;
}
Fonts will be written under Reset styles
/*-----------Fonts-------------------*/
#site-slogan,
.site-slogan,
#page .ui-widget,
.comment-form label,
.node-form label,
.node-form .description {
font-family: Georgia, "Times New Roman", Times, serif;
}
Also i don't think there is any need of cleaning task i.e. what i have derived after reading this link https://www.drupal.org/node/1342054

DickJohnson’s picture

elements.css should not include things like .node-form label.

Also investigated this issue a bit. On Seven theme it looks like font-family is used per component at least in tabs.css and admin-options.css. So my guess is that body, input, select, textarea and button should be moved from typography.css to elements.css and split the rest of the stuff to component-files.

DickJohnson’s picture

Status: Active » Needs review
FileSize
4.99 KB

Played around a bit with this and ended up with solution like this. Need to think a while what to do with rest of stuff.

alexpott’s picture

I'm surprised the idea of splitting up of the typography.css and moving this into individual components. Reading https://www.drupal.org/node/1887922 - isn't font selection about look and feel?

LewisNyman’s picture

We actually don't split the styling for a component into separate files, it's important that the styling for a component is one file, so you can look in one place.

The theme category in SMACSS actually refers to global, page level changes. The example files given in the CSS standards are theme--dark and theme--light

Theme rules may or may not have their own file(s). Starter themes are encouraged to separate their theme CSS into separate files. Otherwise, include theme rules with their corresponding component.

Maybe we need to update the wording of that category in the standards so it's more clear.

LewisNyman’s picture

Status: Needs review » Needs work
  1. +++ b/core/themes/bartik/css/base/elements.css
    @@ -68,6 +68,13 @@ p {
    +input,
    +textarea,
    +select,
    +button,
    +table {
    +  font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
    +}
    

    I think these selectors belong in form.css, buttons.css, and table.css

  2. +++ b/core/themes/bartik/css/components/skip-link.css
    @@ -16,7 +16,7 @@
    +  font: 0.94em font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    

    font-family is included by mistake

alexpott’s picture

re #8 but typography is specifically mentioned on http://smacss.com/book/type-theme

LewisNyman’s picture

Yes, but the situation is different. The situation is when you want to change the font globally across the whole site in a specific context:

Last but not least, there are font rules. Similar to themes, there are times when you need to redefine the fonts that are being used on a wholesale basis, such as with internationalization.

There isn't a situation in Bartik where we want to change the font wholesale, so the is no benefit of containing it within one file. I don't think we have a need for any theme files in Bartik and that's common with a lot of SMACSS projects.

Theme Rules aren't as often used within a project and because of that, they aren't included as part of the core types. Some projects may have a need for them, though.

Maninders’s picture

Assigned: Unassigned » Maninders
Maninders’s picture

Status: Needs work » Needs review
FileSize
6.2 KB

Worked on the LewisNyman comment. typography-2398447.patch

Maninders’s picture

FileSize
2.35 KB

I posted interdiff-2398447-6-13.txt

lauriii’s picture

Status: Needs review » Needs work
+++ b/core/themes/bartik/css/components/buttons.css
@@ -1,5 +1,7 @@
+button {
+  font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
+}
 .button {

We dont have to create new selector here because there is already existing selector for this

Maninders’s picture

Thnx lauriii, for the reply. And i make a selector like button type="submit" not a class, so please test it again. If it's worked then its fine otherwise i will changed it.

Maninders’s picture

Status: Needs work » Needs review
emma.maria’s picture

Assigned: Maninders » Unassigned
LewisNyman’s picture

Status: Needs review » Needs work
  1. +++ b/core/themes/bartik/css/base/elements.css
    @@ -69,6 +69,7 @@ del {
     
    +
     /* ------------------ Reset Styles ------------------ */
    

    We only need one blank line here

  2. +++ b/core/themes/bartik/css/base/typography.css
    @@ -1,35 +1,7 @@
    -#site-slogan,
    -.site-slogan,
    

    The site slogan seems to be missing the font declaration now

  3. +++ b/core/themes/bartik/css/base/typography.css
    @@ -1,35 +1,7 @@
    -#page .ui-widget,
    

    This one is missing also

  4. +++ b/core/themes/bartik/css/base/typography.css
    @@ -1,35 +1,7 @@
    -.comment-form label,
    -.node-form label,
    -.node-form .description {
    

    And these

  5. +++ b/core/themes/bartik/css/base/typography.css
    @@ -1,35 +1,7 @@
     ul.contextual-links,
     ul.links,
     ul.primary,
    

    These need to be moved into the correct files still.
    .contextual-links -> Contextual.css
    .links -> content.css
    .primary -> tabs.css

  6. +++ b/core/themes/bartik/css/base/typography.css
    @@ -1,35 +1,7 @@
    -p.comment-time,
    

    This one has not been moved

  7. +++ b/core/themes/bartik/css/components/form.css
    @@ -10,6 +10,11 @@ form {
    +input,
    +textarea,
    +select {
    +  font-family: "Lucida Grande", "Lucida Sans Unicode", Verdana, sans-serif;
    +}
    

    Can we move these lines down so they are above the input, textarea, and select styling?

rootwork queued 13: typography-2398447.patch for re-testing.

The last submitted patch, 13: typography-2398447.patch, failed testing.

rootwork’s picture

Status: Needs work » Needs review
FileSize
8.63 KB

#13 wasn't applying anymore, so I rerolled. I also tried to address all of the issues from #15 and #19.

Notes:

  • .ui-widget didn't have any existing styles anywhere in Bartik, so I wasn't sure where to put that definition. I put it in content.css, but that might be wrong.
  • .link also hadn't been moved out of typography.css, so I added that definition into elements.css, but I'm not sure if that style should be more properly put on the a element.
  • I moved the .tabs ul.primary definition to tabs.css, but it comes directly after the div.tabs definition with the font-family style, so I'm not sure that's necessary.
  • I tried to do an interdiff but the original didn't apply so I didn't know how to compare the two using git diff, and patchutils interdiff choked on it. Sorry I'm crap at that :/
ramkrk’s picture

Status: Needs review » Needs work

#22, i have been check out and applied your patch file. I found an issue that the pages been shirnked and some text has collapsed in their size. There is slight jerk on all pages before and after the patch: the Site title becomes bigger. To correct this requires font size and type to be defined separately.

+++ b/core/themes/bartik/css/base/elements.css
@@ -2,11 +2,11 @@

body {
line-height: 1.5;
- font-size: 87.5%;
word-wrap: break-word;
margin: 0;
padding: 0;
border: 0;
+ font: 87.5% Georgia, "Times New Roman", Times, serif;
}

font: 87.5% Georgia, "Times New Roman", Times, serif; - this should be an issue. Checked with chromium Version 37.0.2062.120.

ramkrk’s picture

Status: Needs work » Needs review
FileSize
8.5 KB

Here is the updated patch.

ramkrk’s picture

ramkrk’s picture

Ignore #24. Here is the updated patch.

LewisNyman’s picture

Status: Needs review » Needs work

Great! We are just missing one thing.

+++ /dev/null
@@ -1,35 +0,0 @@
-#page .ui-widget,

We are missing this selector

DickJohnson’s picture

Tried to figure out if we're calling that at all, but I'm not sure about it. Couldn't really find it anywhere.

rootwork’s picture

Status: Needs work » Needs review
FileSize
8.51 KB
358 bytes

My bad, I had added .ui-widget instead of #page .ui-widget.

#page doesn't exist anywhere other than the layout.css file (which seemed an inappropriate place to put this definition) so I put it at the end of content.css with other page-related things. It may make more sense somewhere else, though; I'm not sure exactly how it's being used.

LewisNyman’s picture

Status: Needs review » Reviewed & tested by the community

Ah that's why I missed it. In this case, let's just play it safe and figure out how and where it's being used in #2398463: Clean up the "content" component in Bartik

RTBC!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 29: bartik-remove-typography-css-updated-2398447-29.patch, failed testing.

emma.maria’s picture

Assigned: Unassigned » emma.maria
Issue tags: +Needs reroll
emma.maria’s picture

Assigned: emma.maria » Unassigned
Status: Needs work » Needs review
Issue tags: -Needs reroll
FileSize
8.51 KB

Patch rerolled. I diffed my patch with the previous one in #29 and found no changes.

Can someone please put this back to RTBC if they so no problems from the reroll.

LewisNyman’s picture

Status: Needs review » Reviewed & tested by the community

Looks good!

idebr’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/bartik/css/components/pager.css
@@ -1,7 +1,11 @@
+/**
+* @todo: .pager .pager__items also exists in list.css
+*/

This comment is no longer relevant now that #2408653: Remove lists.css from Bartik, add it's current code directly to the components it references. has been committed

emma.maria’s picture

Assigned: Unassigned » emma.maria
emma.maria’s picture

Assigned: emma.maria » Unassigned
Status: Needs work » Needs review
FileSize
8.41 KB
460 bytes

#35 is not related to this issue but as it was left behind as part of another issue and it's a small thing I will add it to the patch.

idebr’s picture

Alright, look good. Thanks, emma.maria! :)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 37: bartik-remove-typography-css-updated-2398447-37.patch, failed testing.

idebr’s picture

Status: Needs work » Needs review
FileSize
8.42 KB
rootwork’s picture

Status: Needs review » Reviewed & tested by the community

Looks like a solid reroll to me.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Now we are removing typography.css we need a place to document the font stack a theme uses... so people like me know how to check whether a change is correct. The same for media queries #2399709: Remove media.css from Bartik, add it's current code directly to the components it references.. But like that patch I'm not going to hold this up on that. But can someone please up an issue to address this.

Committed 82fa1a6 and pushed to 8.0.x. Thanks!

Thanks for adding the beta evaluation to the issue summary.

  • alexpott committed 82fa1a6 on 8.0.x
    Issue #2398447 by emma.maria, rootwork, Maninder, ramkrk, DickJohnson,...
emma.maria’s picture

This issue caused a small CSS regression in Core.

Before:


 

After:


 

I have raised a new issue as I also found that another issue also added a small regression, I have combined the work into this issue... #2422975: Bartik footer has CSS regressions..

PLEASE PLEASE PLEASE add screenshots and manually test Bartik before setting these CSS cleanup issues to RTBC.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.