Sub-issue of #1190252: [573] Use csslint as a weapon to beat the crappy CSS out of Drupal core

Inline with the CSS cleanup efforts of the HTML5 initiative, using CSSLint at http://csslint.net provides a quick way to code-sniff our css and tweak styles.

  1. Copy and paste the the stylesheet(s) below into the css lint tool at http://csslint.net and test.
  2. Fix any warnings or errors the tool finds.
  3. Patch Drupal 8 locally and make sure the css changes have not broken anything visually.
  4. Create patch and upload for the testbot.

Files:modules/system/system.theme.css

Comments

robloach’s picture

albert volkman’s picture

Status: Active » Needs review
StatusFileSize
new3.11 KB

First pass. Still some outstanding issues that I'm not entirely sure how to address.

oresh’s picture

StatusFileSize
new8.43 KB

#2 patch is no longer executable - the code has changed a lot.
Cleared some styles with CSS Lint, sorted them with CSS Comb
Also changed some dimensions from px to em (as in most of the css)
Patch applies both for system.theme.css and system.theme-rtl.css

oresh’s picture

Issue tags: -html5
enhdless’s picture

Issue summary: View changes
Status: Needs review » Needs work

Upon testing the patch:

system_theme_css_cleanup-1663184-3.patch:161: trailing whitespace.
abbr.form-required, 
system_theme_css_cleanup-1663184-3.patch:162: trailing whitespace.
abbr.tabledrag-changed, 
error: core/modules/system/system.theme-rtl.css: No such file or directory
error: core/modules/system/system.theme.css: No such file or directory

Patch should be rerolled.

ckrina’s picture

Assigned: Unassigned » ckrina

Starting with the reroll.

ckrina’s picture

Assigned: ckrina » Unassigned
Status: Needs work » Needs review
StatusFileSize
new10.81 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 7: 1663184-system_theme_css_cleanup-7.patch, failed testing.

lewisnyman’s picture

Issue tags: +frontend, +CSS

Sorry this now needs a reroll. I will try and review it soon after it is posted next time. Also I'm not sure if we should run the CSS through CSS comb here, we aren't doing that anywhere else? We should probably run every CSS file through it in one patch for consistency.

lewisnyman’s picture

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

Assigned: Unassigned » emma.maria
lewisnyman’s picture

Assigned: emma.maria » Unassigned
sumeetjaggi’s picture

Status: Needs work » Needs review
Issue tags: +SprintWeekend2015
StatusFileSize
new9.89 KB

Patch Re rolled!

lewisnyman’s picture

Status: Needs review » Needs work

Bah! Looks like this got knocked out on the same day by #2372023: Description of display settings takes too much space

emma.maria’s picture

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

Assigned: emma.maria » Unassigned
Status: Needs work » Needs review
StatusFileSize
new9.21 KB

Rerolled.

idebr’s picture

Status: Needs review » Needs work

Patch no longer applies after #2417705: Autocomplete suggestions visual regression after modal and jQuery UI update was committed.

error: patch failed: core/modules/system/css/system.theme.css:200
error: core/modules/system/css/system.theme.css: patch does not apply

rteijeiro’s picture

Status: Needs work » Needs review
StatusFileSize
new9.58 KB

Re-rolled and fixed a few CSSLint errors. Still needs some word in tabs__tab and progress bars. Working on it.

pwieck’s picture

Issue tags: -Needs reroll
mortendk’s picture

Issue tags: +csslint
idebr’s picture

Status: Needs review » Needs work

Not sure on the attribute shuffling, we don't use CSS comb anywhere else. It also doesn't help the review process or make the code any more readable than before. It also doesn't throw any warnings on CSS Lint. @LewisNyman do you think we can remove this part of the patch?

+++ b/core/modules/system/css/system.theme.css
@@ -126,8 +126,7 @@ abbr.ajax-changed {
-.container-inline .form-actions,
-.container-inline.form-actions {
+.container-inline .form-actions {

The concatenated selector was introduced in #162047: .container-inline class overridden by system.theme.css; also not working with .form-actions to fix the display of .container-inline on #type => 'action' form elements. This pattern is still in use for example on the 'Recent log messages' page so this line should not be removed.

lewisnyman’s picture

If we need it then I guess we need it, it's going to be hard to fix every error in this issue without having to focus on an individual component, so let's try and fix the easy wins here and maybe introduce follow ups to deal with tricky components

lewisnyman’s picture

Karmen’s picture

Assigned: Unassigned » Karmen
Karmen’s picture

StatusFileSize
new11.38 KB

Reroll made and fixed some warnings in CSS Lint.

lewisnyman’s picture

Assigned: Karmen » Unassigned
Status: Needs work » Needs review
rteijeiro’s picture

Status: Needs review » Needs work
+++ b/core/modules/system/css/system.theme.css
@@ -446,73 +483,73 @@ ul.tabs {
+  background: no-repeat 10px 17px;  /* LTR */

Remove extra space before /* LTR */

keopx’s picture

StatusFileSize
new12.42 KB

Reroll and I removed extra space before /* LTR */

keopx’s picture

Status: Needs work » Needs review
lewisnyman’s picture

Issue summary: View changes
Status: Needs review » Needs work
StatusFileSize
new78.78 KB

I found three errors when I ran it though csslint:

  1. +++ b/core/modules/system/css/system.theme.css
    @@ -210,34 +211,38 @@ details > .details-wrapper {
    +  -ms-transform: rotate(-90deg);
    +  -moz-transform: rotate(-90deg);
    +  -o-transform: rotate(-90deg);
    ...
    +  -ms-transform: rotate(90deg);
    +  -moz-transform: rotate(90deg);
    +  -o-transform: rotate(90deg);
    

    According to caniuse data, we no longer need the -moz- and -o- prefixes

  2. +++ b/core/modules/system/css/system.theme.css
    @@ -278,14 +283,55 @@ th.checkbox {
    +  background-image: -moz-linear-gradient(#e7e7df, #f0f0f0);
    +  background-image: -webkit-gradient(linear, color-stop(0%,#e7e7df), color-stop(100%,#f0f0f0));
       background-image: -webkit-linear-gradient(#e7e7df, #f0f0f0);
    -  background-image:         linear-gradient(#e7e7df, #f0f0f0);
    +  background-image: -o-linear-gradient(#e7e7df, #f0f0f0);
    +  background-image: -ms-linear-gradient(#e7e7df,  #f0f0f0);
    +  background-image: linear-gradient(#e7e7df, #f0f0f0);
    ...
    +    -moz-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
    +    -moz-linear-gradient( left top,
    ...
    +    -o-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
    +    -o-linear-gradient( left top,
    ...
    +    -ms-linear-gradient( top, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.15) ),
    +    -ms-linear-gradient( left top,
    

    We don't need any of these vendor prefixes according to caniuse data

  3. +++ b/core/modules/system/css/system.theme.css
    @@ -446,80 +484,80 @@ ul.tabs {
     .button-action:before {
    -  content: '+';
    -  font-weight: 900;
       margin-left: -0.1em; /* LTR */
       padding-right: 0.2em; /* LTR */
    +  content: '+';
    +  font-weight: 900;
     }
     [dir="rtl"] .button-action:before {
    -  margin-left: 0;
       margin-right: -0.1em;
    -  padding-left: 0.2em;
    +  margin-left: 0;
       padding-right: 0;
    +  padding-left: 0.2em;
     }
    

    It looks like we don't add the margin-right where we should for RTL

  4. +++ b/core/modules/system/css/system.theme.css
    @@ -446,80 +484,80 @@ ul.tabs {
     .messages + .messages {
    -  margin-top: 1.538em;
    +  margin-top: 1.54em;
    ...
     .messages__item + .messages__item {
    -  margin-top: 0.769em;
    +  margin-top: 0.77em;
    

    Can we keep these values as they are? I think these now round to uneven pixel units

Karmen’s picture

Status: Needs work » Needs review
StatusFileSize
new11.44 KB

Is it fine?
Thanks!

rteijeiro’s picture

Karmen’s picture

StatusFileSize
new2.8 KB

Upload an interdiff. Sorry!

lewisnyman’s picture

Thanks, this definitely needs regression testing.

+++ b/core/modules/system/css/system.theme.css
@@ -46,8 +46,8 @@ td.is-active {
+.odd .form-item,
+.even .form-item {

@@ -55,17 +55,16 @@ tr.even .form-item {
-label.option {
+.option {

I am worried that these classes are too generic and will cause issues in other, unintended places.

I'm tempted to postpone this on #2395853: Split system.module.css and system.theme.css files into SMACSS style components, what do other people think?

ti2m’s picture

StatusFileSize
new85.49 KB

I ran the patch through siteeffect and I found a lot of regressions, especially related to lists and tabs. See the gif as an example, it's taken from /admin/appearance/settings/seven

rteijeiro’s picture

Status: Needs review » Needs work
rteijeiro’s picture

+1 to postpone as Lewis suggested in #35

maninders’s picture

Assigned: Unassigned » maninders
Issue tags: +india
maninders’s picture

Assigned: maninders » Unassigned
Status: Needs work » Needs review
StatusFileSize
new6.05 KB

Please find the attached patch which removed all the csslint issues.

lewisnyman’s picture

mgifford’s picture

Status: Postponed » Needs review

Status: Needs review » Needs work

The last submitted patch, 40: clean-up-system-theme-css-1663184-40.patch, failed testing.

lewisnyman’s picture

Can we replace these issues with individual issues for each file? It would make it easier to work on. Does anyone want to create the issues? :)

hog’s picture

Status: Needs work » Needs review
StatusFileSize
new14.39 KB
new14.55 KB

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

maninders’s picture

Update the issue summary. system.theme.css is not available in core/modules/system/

manjit.singh’s picture

@Maninders yeah right !!! All the css (system.theme.css) has moved to the seven as it is backend theme so rather we have to close this issue or need to update the issue summary.

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

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should 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.

wturrell’s picture

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

Unable to apply patch against 8.2.x for ajax-progress.module.css and progress.module.css

jofitz’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new14.39 KB

Re-roll.

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

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should 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.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should 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.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should 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.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should 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.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.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.

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

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should 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.

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

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

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

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

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should 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.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should 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

Status: Needs review » Needs work
Issue tags: +Needs Review Queue Initiative

This issue is being reviewed by the kind folks in Slack, #need-reveiw-queue. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge require as a guide.

Some of the changes of the patch appear to have already landed but not all.

Also this was tagged for visual regression testing and issue summary update that still needs to happen.

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

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mstrelan’s picture

Status: Needs work » Postponed (maintainer needs more info)

The parent issue #1190252: [573] Use csslint as a weapon to beat the crappy CSS out of Drupal core was closed in favour of #2865971: Use stylelint as opposed to csslint in core. I suspect that means the steps in the issue summary are no longer applicable. Can we close this one?

smustgrave’s picture

Since there's been no follow up going to assume we can close this one.

smustgrave’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.