Problem/Motivation

See: #1995272: [Meta] Refactor module CSS files inline with our CSS standards

Proposed resolution

Review the CSS against our standards, see:
http://drupal.org/node/1887918#best-practices
https://www.drupal.org/node/2408617
#1190252: [573] Use csslint as a weapon to beat the crappy CSS out of Drupal core

Remaining tasks

Delete the CSS file and set the width in the dialog API. See: #2489884: Give the views modal window a larger width
Check for visual regressions

User interface changes

None

Seven wide before patch:

Seven wide before patch

Seven wide after patch:

Seven wide after patch

More screenshots at #36

API changes

None

CommentFileSizeAuthor
#52 clean_up_editor_css-2485425-52.patch3.56 KBalvar0hurtad0
#43 interdiff-2485425-38-43.txt367 bytesiro
#43 clean_up_editor_css-2485425-43.patch3.58 KBiro
#39 interdiff-2485425-31-34.txt1.82 KBMathieuSpil
#38 interdiff.txt509 bytesWim Leers
#38 Clean-up-editor-CSS-2485425-38.patch3.58 KBWim Leers
#36 bartik wide after.png220.96 KBiro
#36 bartik narrow after.png116.38 KBiro
#36 classy wide after.png292.77 KBiro
#36 classy narrow after.png120.8 KBiro
#36 seven wide after.png257.62 KBiro
#36 seven narrow after.png130.5 KBiro
#36 seven narrow before.png125.46 KBiro
#36 seven wide before.png238.55 KBiro
#36 classy wide before.png286.13 KBiro
#36 classy narrow before.png133.55 KBiro
#36 bartik wide before.png236.97 KBiro
#36 bartik narrow before.png130.01 KBiro
#34 Clean-up-editor-CSS-2485425-34.patch3.58 KBkostask
#31 interdiff-29-31.txt1.86 KBwiifm
#31 2485425-31.patch2.29 KBwiifm
#29 interdiff-23-29.txt786 bytesMathieuSpil
#29 Clean-up-editor-CSS-2485425-29.patch2.43 KBMathieuSpil
#23 Screen Shot 2015-09-21 at 13.08.24.png112.83 KBsaki007ster
#23 interdiff-19-23.txt1.39 KBsaki007ster
#23 Clean-up-editor-CSS-2485425-23.patch1.43 KBsaki007ster
#19 Clean-up-editor-CSS-2485425-19.patch1.14 KBStudiographene
#15 clean-up-editor-css-2485425-13.patch1.11 KBMathieuSpil
#12 interdiff-2485425-7-12.txt24.31 KBMathieuSpil
#12 clean-up-editor-css-2485425-12.patch1.11 KBMathieuSpil
#7 clean-up-editor-css-2485425-7.patch24.21 KBManjit.Singh
#2 editor.png151.43 KBManjit.Singh
editor.css_.txt275 bytesLewisNyman
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rudraram’s picture

CSS lint is clean except usage of !important. Don't know how the removal impacts.

Manjit.Singh’s picture

Issue summary: View changes
FileSize
151.43 KB

editor

This is what !important doing :) @lewis how will we tackle this

Manjit.Singh’s picture

Issue summary: View changes
Wim Leers’s picture

Assigned: Unassigned » LewisNyman

For #2.

LewisNyman’s picture

Assigned: LewisNyman » Unassigned
Issue summary: View changes

Ah I see, it seems like this is very easy to modify in the modal API, see the solution in #2489884: Give the views modal window a larger width - the responsiveness is handled in Seven's CSS which makes sense. This means if we follow the same solution as views we can delete this CSS completely, which is at least consistent - I think in the future we should just set a default width in the theme and remove all these per-module decisions. That's a policy issue though and shouldn't be done here.

Manjit.Singh’s picture

Assigned: Unassigned » Manjit.Singh

Working on it...

Manjit.Singh’s picture

Assigned: Manjit.Singh » Unassigned
Status: Active » Needs review
FileSize
24.21 KB

removing width: 300px from core/assets/vendor/jquery.ui/ui/dialog-min.js also remove css as per suggestion in #5

nod_’s picture

Status: Needs review » Needs work

We can't touch vendor files. Revert the change to jquery.ui/ui/dialog-min.js please.

Manjit.Singh’s picture

Thanks nod_
@lewis can you suggest a better approach of this to do, rather than changes in core/assets/vendor/jquery.ui/ui/dialog-min.js

MathieuSpil’s picture

Assigned: Unassigned » MathieuSpil

Looking into this.

I suppose we can avoid the use of the 'important by defining a min-width and max-width instead of trying to overwrite the width defined by the vendor.
Will be trying it out.

MathieuSpil’s picture

Alright, min and max-widths are not very combinable with a inline css styling without using !important. (So we shouldn't be following my suggestion in #10)

A better and more robust approach: Use the widget the way it is supposed to be used and define the widths-restrictions with attributes inside the widget: https://api.jqueryui.com/dialog/#option-maxWidth for example.

Looking into this.

MathieuSpil’s picture

So following some assumptions on how the !important should be removed.
1) We shouldn't hack vendor files, so resetted that.
2) The width: 80% !important was defined inside core/modules/editor/css/editor.css so the width would have been 80% on desktop, non-theme-specific.
3) Reading #5 + assuming the width of 80% is the width we want for desktop (and 95% width on small screens) => if should define the width in the options of the module at 95% and let the theme take care of the max-width property on its own breakpoints etc.
4) If we don't supply a value for the jquery-ui-dialog, the default value is 300px, which is silly to overwrite the widht-property with css ( https://api.jqueryui.com/dialog/#option-width )

I found where the width should be defined for these dialogs. The only purpose of the theme's css is then to define what the max-width should be of each dialog. The only question I have with this patch is: If we decide to take this approach and make the default width 95% for these dialogs, and just defining the max width in themes, shouldn't we then just supply the width of 100% so this issue doesn't get re-openened the next time someone wants to make this 96% or higher?

MathieuSpil’s picture

Assigned: MathieuSpil » Unassigned
Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: clean-up-editor-css-2485425-12.patch, failed testing.

MathieuSpil’s picture

One of the latest 50 commits on drupal core made the patch non-apply-able, so rerolled.
(doing exactly the same as in #12 so no need for interdiff)

MathieuSpil’s picture

Status: Needs work » Needs review
LewisNyman’s picture

Status: Needs review » Needs work

I think that in a perfect world, we should avoid doing stuff like this and just let the themes handle it. The problem here is that the editor module is defining it's own variant class, so it's going to be easily missed by themes. It also looks really bad at full width.

I think that the best thing to do will be to replace the class with .ui-dialog--narrow, then move this CSS into both Seven and Bartik, and delete this module CSS. How does that sound?

Wim Leers’s picture

Issue tags: +Needs reroll, +Novice, +CSS novice

#17++

Studiographene’s picture

This is a latest re rolled patch!

Manjit.Singh’s picture

Status: Needs work » Needs review
Wim Leers’s picture

Status: Needs review » Needs work

#19: "Needs reroll" does not necessarily mean "apply it and upload it". It also means "needs latest feedback addressed". See #17.

saki007ster’s picture

Assigned: Unassigned » saki007ster
saki007ster’s picture

Updated the patch in #19 to include comments in #17 removed full width as well. I have attached the screenshot for the reference.

I have removed the css from the module but to include it to themes like seven and bartik we should have different issues for them.

saki007ster’s picture

Status: Needs work » Needs review
saki007ster’s picture

Assigned: saki007ster » Unassigned

Status: Needs review » Needs work

The last submitted patch, 23: Clean-up-editor-CSS-2485425-23.patch, failed testing.

MathieuSpil’s picture

Assigned: Unassigned » MathieuSpil

MathieuSpil’s picture

Assigned: MathieuSpil » Unassigned
Status: Needs work » Needs review
FileSize
2.43 KB
786 bytes

Added the css to Seven and Bartik, so we could iterate on that.

If we use the .ui-dialog--narrow-class, shouldn't we be using the .ui-dialog class too on this element?

.

wiifm’s picture

Assigned: Unassigned » wiifm
Status: Needs review » Needs work
Issue tags: -Needs reroll +d8tam

Going to have a go at changing the classes to match Drupal's CSS coding standards.

wiifm’s picture

Assigned: wiifm » Unassigned
Status: Needs work » Needs review
FileSize
2.29 KB
1.86 KB

I have left the class .ui-dialog--narrow intact, as the component class of .ui-dialog is already there, so the modifier makes sense. I have also brought the CSS changes into the parent theme classy, as then it is inherited down to the sub themes.

kostask’s picture

Assigned: Unassigned » kostask

The inline width that jquery places on ui-dialog forces seven to use important statements like:

@media all and (max-width: 48em) { /* 768px */
.ui-dialog {
width: 92% !important;
}
}

I will work on that trying to switch the width to auto and use min and max-width for setting ui-dialog's width.

MathieuSpil’s picture

don't mind me

kostask’s picture

Assigned: kostask » Unassigned
FileSize
3.58 KB

I have worked on the patch with iro and also discussed it with MathieuSpil. This is what we did:

Replaced the editor-dialog class with the ui-dialog--narrow.
Removed the editor-dialog class from the tests, since it is not used anymore.
Moved the editor's module css to classy.
Added a default width of auto to ckeditor.js so it will be easier for themes to override it using max and min-width.
Replaced the important declaration of seven theme with min and max width.

kostask’s picture

double post

iro’s picture

Adding screenshots from all themes affected.
There are no user interface changes as intended.

1. Seven wide before patch:

Seven wide before patch

2. Seven wide after patch:

Seven wide after patch

3. Seven narrow before patch:

Seven narrow before patch

4. Seven narrow after patch:

Seven narrow after patch

5. Bartik wide before patch:

Bartik wide before patch

6. Bartik wide after patch:

Bartik wide after patch

7. Bartik narrow before patch:

Bartik narrow before patch

8. Bartik narrow after patch:

Bartik narrow after patch

9. Classy wide before patch:

Classy wide before patch

10. Classy wide after patch:

Classy wide after patch

11. Classy narrow before patch:

Classy narrow before patch

12. Classy narrow after patch:

Classy narrow after patch

wiifm’s picture

Nice work on the screenshots there @iro! There appears to be no visual regression in the screenshots, and the new CSS is much easier to override and much cleaner. RTBC+1 from me.

Wim Leers’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
3.58 KB
509 bytes

@iro: Thanks for the visual regression testing!

+++ b/core/themes/classy/css/components/ui-dialog.css
@@ -0,0 +1,14 @@
+ * Styles for Classy's modal windows

Nit: missing trailing period. Fixed that silly typo myself.


Given that #36 shows there are no visual regressions, and the patch in #34 implements exactly what @LewisNyman asked in #17, and I only fixed a typo here, I think I can RTBC this.

MathieuSpil’s picture

FileSize
1.82 KB

Good work here @kostask and @iro!

@kostask: If you work on a ticket where there is already a history of patches, your explanation in #34 can be clarified + checked by supplying an interdiff. Like so:https://www.drupal.org/documentation/git/interdiff

RTBC +1

LewisNyman’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/themes/classy/css/components/ui-dialog.css
@@ -0,0 +1,14 @@
+/**
+ * @file
+ * Styles for Classy's modal windows.
+ */
+.ui-dialog--narrow {

Sorry! Our comment standards require a blank line after the @file comments. Apart from that this patch is good.

Wim Leers’s picture

Damn it! @LewisNyman outnitpicked me :P

iro’s picture

Assigned: Unassigned » iro

I will add the blank line as indicated by #40.

iro’s picture

Here is the patch.
@wiifm, @Wim Leers, @MathieuSpil: Thank you for your kind words.

iro’s picture

Assigned: iro » Unassigned
Status: Needs work » Needs review

Oops, forgot to change status.

kostask’s picture

Status: Needs review » Reviewed & tested by the community

Since all comments are addressed I am RTBCing that one.

@MathieuSpil thanks for the tip!

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 43: clean_up_editor_css-2485425-43.patch, failed testing.

The last submitted patch, 43: clean_up_editor_css-2485425-43.patch, failed testing.

wiifm’s picture

Status: Needs work » Reviewed & tested by the community

Looks like the bot failed randomly (error was "

fail: [Completion check] Line 78 of core/modules/migrate_drupal/src/Tests/MigrateDrupalTestBase.php:
The test did not complete due to a fatal error.

")

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 43: clean_up_editor_css-2485425-43.patch, failed testing.

Wim Leers’s picture

Issue tags: +Needs reroll

Now it is a legitimate failure, due to #2566771: [Voltron patch] Move all remaining *.theme.css to Classy having been committed yesterday.

alvar0hurtad0’s picture

Status: Needs work » Needs review
FileSize
3.56 KB

Here is the patch rerolled

LewisNyman’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs reroll

Good stuff, thank you.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 52: clean_up_editor_css-2485425-52.patch, failed testing.

Wim Leers’s picture

Status: Needs work » Reviewed & tested by the community

PIFR is drunk.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

This looks like a good cleanup of editor's CSS and thanks for all the screenshots. Committed b8a6e72 and pushed to 8.0.x. Thanks!

  • alexpott committed b8a6e72 on 8.0.x
    Issue #2485425 by MathieuSpil, iro, saki007ster, Wim Leers, Manjit.Singh...
star-szr’s picture

This removed editor.css but didn't remove it from the library definition. Here's a small follow-up: #2587563: editor.libraries.yml references editor.css which has been removed

Status: Fixed » Closed (fixed)

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