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 after patch:
More screenshots at #36
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#52 | clean_up_editor_css-2485425-52.patch | 3.56 KB | alvar0hurtad0 |
#43 | interdiff-2485425-38-43.txt | 367 bytes | iro |
#43 | clean_up_editor_css-2485425-43.patch | 3.58 KB | iro |
#39 | interdiff-2485425-31-34.txt | 1.82 KB | MathieuSpil |
#38 | Clean-up-editor-CSS-2485425-38.patch | 3.58 KB | Wim Leers |
Comments
Comment #1
rudraram CreditAttribution: rudraram at Axelerant commentedCSS lint is clean except usage of !important. Don't know how the removal impacts.
Comment #2
Manjit.SinghThis is what !important doing :) @lewis how will we tackle this
Comment #3
Manjit.SinghComment #4
Wim LeersFor #2.
Comment #5
LewisNymanAh 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.
Comment #6
Manjit.SinghWorking on it...
Comment #7
Manjit.Singhremoving
width: 300px
fromcore/assets/vendor/jquery.ui/ui/dialog-min.js
also remove css as per suggestion in #5Comment #8
nod_We can't touch vendor files. Revert the change to jquery.ui/ui/dialog-min.js please.
Comment #9
Manjit.SinghThanks 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
Comment #10
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedLooking 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.
Comment #11
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedAlright, 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.
Comment #12
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedSo 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?
Comment #13
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedComment #15
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedOne 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)
Comment #16
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedComment #17
LewisNymanI 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?Comment #18
Wim Leers#17++
Comment #19
Studiographene CreditAttribution: Studiographene commentedThis is a latest re rolled patch!
Comment #20
Manjit.SinghComment #21
Wim Leers#19: "Needs reroll" does not necessarily mean "apply it and upload it". It also means "needs latest feedback addressed". See #17.
Comment #22
saki007sterComment #23
saki007sterUpdated 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.
Comment #24
saki007sterComment #25
saki007sterComment #27
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedComment #29
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedAdded 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?.
Comment #30
wiifmGoing to have a go at changing the classes to match Drupal's CSS coding standards.
Comment #31
wiifmI 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.Comment #32
kostask CreditAttribution: kostask as a volunteer commentedThe 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.
Comment #33
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commenteddon't mind me
Comment #34
kostask CreditAttribution: kostask as a volunteer commentedI 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.
Comment #35
kostask CreditAttribution: kostask as a volunteer commenteddouble post
Comment #36
iro CreditAttribution: iro commentedAdding screenshots from all themes affected.
There are no user interface changes as intended.
1. Seven wide before patch:
2. Seven wide after patch:
3. Seven narrow before patch:
4. Seven narrow after patch:
5. Bartik wide before patch:
6. Bartik wide after patch:
7. Bartik narrow before patch:
8. Bartik narrow after patch:
9. Classy wide before patch:
10. Classy wide after patch:
11. Classy narrow before patch:
12. Classy narrow after patch:
Comment #37
wiifmNice 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.
Comment #38
Wim Leers@iro: Thanks for the visual regression testing!
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.
Comment #39
MathieuSpil CreditAttribution: MathieuSpil as a volunteer commentedGood 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
Comment #40
LewisNymanSorry! Our comment standards require a blank line after the @file comments. Apart from that this patch is good.
Comment #41
Wim LeersDamn it! @LewisNyman outnitpicked me :P
Comment #42
iro CreditAttribution: iro commentedI will add the blank line as indicated by #40.
Comment #43
iro CreditAttribution: iro commentedHere is the patch.
@wiifm, @Wim Leers, @MathieuSpil: Thank you for your kind words.
Comment #44
iro CreditAttribution: iro commentedOops, forgot to change status.
Comment #45
kostask CreditAttribution: kostask at Point Blank commentedSince all comments are addressed I am RTBCing that one.
@MathieuSpil thanks for the tip!
Comment #49
wiifmLooks like the bot failed randomly (error was "
")
Comment #51
Wim LeersNow it is a legitimate failure, due to #2566771: [Voltron patch] Move all remaining *.theme.css to Classy having been committed yesterday.
Comment #52
alvar0hurtad0Here is the patch rerolled
Comment #53
LewisNymanGood stuff, thank you.
Comment #55
Wim LeersPIFR is drunk.
Comment #56
alexpottThis looks like a good cleanup of editor's CSS and thanks for all the screenshots. Committed b8a6e72 and pushed to 8.0.x. Thanks!
Comment #58
star-szrThis 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