Problem/Motivation
According to Drupal's CSS Standards...
Layout — macro arrangement of a web page, including any grid systems.
Therefore layout.css should only contain the basic page layout "grid" styles and nothing specific to particular components on the page
for eg. Float styles for sidebar should go into sidebar.css and padding styles for a particular component should go into the component files being referenced etc
Proposed resolution
Move any styles that do not belong in layout.css out into the relevant component files found in css/component/....
Clean up the relevant layout styles left in the file, make sure the CSS follows the CSS standards here.
Remaining tasks
Write a patch.
Visual review of the patch to check that nothing has changed + screenshots - we are not changing the design!
Code review of the patch to check the work is correct.
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
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 |
Comment | File | Size | Author |
---|---|---|---|
#68 | 2398451-68.patch | 14.34 KB | idebr |
#65 | 2309451-65.patch | 14.54 KB | idebr |
#61 | 2398451-61.patch | 14.5 KB | idebr |
#58 | interdiff-2398451-55-58.txt | 1.58 KB | DickJohnson |
#58 | 2398451-58.patch | 14.53 KB | DickJohnson |
Comments
Comment #1
emma.mariaComment #2
emma.mariaComment #3
Dragan Eror CreditAttribution: Dragan Eror commentedComment #4
Dragan Eror CreditAttribution: Dragan Eror commentedI've just moved stuff from layout.css to appropriate component css file, didn't look about coding standard in this patch.
Comment #5
Dragan Eror CreditAttribution: Dragan Eror commentedFixed new line errors from previous patch...
Comment #6
Dragan Eror CreditAttribution: Dragan Eror commentedRemoved white space in page.css.
Comment #7
idebr CreditAttribution: idebr commentedThis patch should also make the switch from id selectors to classes in line with the Drupal CSS coding standards. This change was originally one issue, but was split into subtasks to make the transition easier. More info available #2347751: Remove id selectors from templates of Bartik
Comment #8
thamasI think we should keep the rest of the file in layout.css and shold not move it to a "page" component. (Page is not a compoent IMHO.)
The following rules are about #content so they should be in the content component.
I was also thinking about if we should use modifiers like .content--one-sidebar, .content--two-sidebars, .content--first-sidebar etc. instead of using context.
Comment #9
thamasComment #10
idebr CreditAttribution: idebr commentedThe remaining css in layout.css no longer has any id selectors. To complete the transition, the id selector would have to replaced in every file that references this selector. Instead, I added an additional class on the element with the id and used that selector instead. After each file has been cleaned, the id attribute can be removed from the template file.
Done
Ideally, yes. But this would require preprocessing for each separate element instead adding a body class. The current implementation is a lot more practical, so I kept it for now.
Comment #11
idebr CreditAttribution: idebr commentedComment #12
thamasShould use the newly added .main__content class instead?
Also should be moved to components/content.scss
Keeping the body class usage is OK, I think. :)
Comment #13
idebr CreditAttribution: idebr commentedYes, correct. I updated the patch accordingly.
Done
Alright :)
Comment #14
thamasA small thing: maybe it would be better to use
.main-content
instead of.main__content
because.main
is not a component but a layout element (if I'm right).main
but we do not call them eg..main__sidebar-first
(and we should not)If I'm right, "content.css" should be renamed to "main-content.css" too.
Comment #15
idebr CreditAttribution: idebr commentedYes, either
.main
or.main-content
would work for me. Bartik currently has a weird construction where a<div id="main">
wraps the<main>
element. I have removed the redundant wrapper and added the.main-content
class to the<main>
element.Lets leave this for #2398463: Clean up the "content" component in Bartik depending on what gets committed for this issue.
Comment #16
LewisNymanComment #17
thamas@LevisNyman Ohh. So no changes in moved code, only in the remaining code. I understand but sad because of made work idebr more than it was needed… :(
I add the related issues here to help who work on those keep an eye on this issue.
Comment #18
thamasHm, I'm not able to save related issues…
Comment #19
thamasOhh, I had to (start to) write the title of the issue instead of its id… :)
Comment #20
DickJohnson CreditAttribution: DickJohnson commentedJust my two cents about the naming. Content.css will be renamed and splitted up anyways, so there's no need to handle it here.
Comment #21
LewisNymanLet's keep this issue focused. Maybe we should start again from the patch in #2398451: Clean up "layout" CSS in Bartik? It's very hard to keep track of changes if we are also moving the code around into different files. We have an issue to handle the naming conventions for content.css etc
Comment #22
Dragan Eror CreditAttribution: Dragan Eror commented@LewisNyman which patch? :)
You linked to this issue, but we have multiple patches. Guess you wanted to link specific comment?
Comment #23
LewisNyman@Dragan Eror Ah yes thanks, I meant the patch in #10
Comment #24
idebr CreditAttribution: idebr commentedThe patches after #10 only change id selectors to class selectors, update existing code to adhere to the current CSS coding standards and provides a base for other cleanup issues to work with. Taking these changes out to make reviewing a little easier seems like a step backwards to me.
The cleanup in files other than layout.css is relatively minor compared to the changes to the layout.css itself. The nice thing about these changes is all the selectors can be tested on a single (home-)page. Perhaps a report like #2399709: Remove media.css from Bartik, add it's current code directly to the components it references. would help or some full page screenshots would help?
Comment #25
thamasAnother thing: shouldn't we postpone #2398463: Clean up the "content" component in Bartik and #2398471: Clean up the "footer" component in Bartik until this issue is resolved? They are affected by the output of this issue.
Comment #26
DickJohnson CreditAttribution: DickJohnson commentedDon't think so. Even there will be rerolls as we touch the same code etc the major discussion we have on content or footer clearup is mostly completely different.
Comment #27
emma.mariaWe shouldn't postpone any issues. There are no dependencies between these issues. we should get them all ready no matter what they affect as we have no idea which order the issues will be looked at and committed.
Comment #28
idebr CreditAttribution: idebr commentedDone
Screenshot desktop (before/after):
Screenshot desktop RTL (before/after):
Comment #29
LewisNymanSorry to be annoying, but I think we have an opportunity here to rename this class to something reusable and meaningful. This looks similar in purpose to th 'layout-container' class we use in the Seven theme. I think we can rename it to that?
Comment #30
thamasHere is the patch rerolled from #2398451-28: Clean up "layout" CSS in Bartik. I've just simply replaced all "layout-section" to "layout-container".
Comment #31
LewisNymanThanks, I don't think we need more screenshots.
We need to update this CSS comment to match the new class name.
Comment #32
thamasNow it says: Container
Comment #33
LewisNymanAh no reroll needed :(
Comment #34
idebr CreditAttribution: idebr commentedRerolled the patch and applied two fixes:
This line was not updated when the footer regions were renamed.
I had to reintroduce this wrapper since min-height together with margin has a different size than before where these selectors were applied on two different elements.
Comment #35
DickJohnson CreditAttribution: DickJohnson commentedLooks good.
Compared layouts in different widths after reroll.
Desktop before:
Desktop after:
Tablet before:
Tablet after:
Mobile before:
Mobile after:
Mobile footer before:
Mobile footer after:
Comment #37
idebr CreditAttribution: idebr commentedDrupal\system\Tests\Routing\ExceptionHandlingTest->testBacktraceEscaping()
I doubt that's related
Comment #39
idebr CreditAttribution: idebr commentedBack to RTBC per #35 after testbot hickup.
Comment #40
webchickHm, this no longer applies for me.
Comment #41
saki007sterrerolled the patch in #34
Comment #42
saki007sterComment #43
LewisNymanI diffed the two patches using
diff 2398451-34.patch 2398451-41.patch
. There seems to be a big difference between the two patches, I've attched the output. I'm not sure if this means we are missing something or not, but it probably needs another manual test.Comment #44
idebr CreditAttribution: idebr commentedI updated my local branch from #34 and I can confirm the reroll in #41 missed quite a big hunk in layout.css. Attached patch is a new reroll from #34 with the changes from #2422975: Bartik footer has CSS regressions. merged in.
Some before/after screenshots for good measure:
Comment #45
LewisNyman@idebr Hey, I think you missed the patch?
Comment #46
idebr CreditAttribution: idebr commentedUgh.. thanks
Comment #47
emma.mariaI found a problem with the CSS. We need to remove the margin for default .region-header selector. See screenshots below code snippet.
Also we have lost the media query selectors for region-header in the latest patch which is causing the regression on desktop currently.
Can the following code please be added to header.css file....
The code above was removed from layout.css and not added to header.css.
Otherwise I have found no other CSS regressions. The Layout file now only contains the appropriate CSS needed.
Here are screenshots with the before and after patches screenshots overlayed with the top one at 50% opacity to compare.
Mobile (Looks great)
Tablet (Looks great)
Desktop (with the one regression bug mentioned above)
Also tagging with Novice incase someone new wants to have a go creating a new patch from the patch in #46 containing the small fixes above.
Comment #48
idebr CreditAttribution: idebr commented@emma.maria Thanks for the extensive testing :). I can confirm the media queries for the
.region-header
were missing. I have re-added them in the attached patch.Comment #49
emma.mariaThat's great, thanks @idebr!
One last thing can you please remove the margin from this section. It is there by mistake and is only needed for the 461 - 900px section.
Comment #50
idebr CreditAttribution: idebr commentedSure! I was hesitant to remove it since the proposed resolution was not to change the existing design, but as long as you're okay with it :)
Comment #51
emma.mariaBah! On second thoughts let's leave that margin bug out of this issue as it is a design change (even if it is one line of CSS) and raise a follow up issue.
The patch to be considered is from #48.
I am reposting the patch from @idebr in #48 here again to not confuse people.
This patch fixes the missing CSS problem mentioned in #47 and introduces no other regressions from #46.
All looks good to me! RTBC.
Comment #52
emma.mariaComment #53
emma.mariaComment #55
idebr CreditAttribution: idebr commentedReroll after #2398469: Clean up the "Featured-top" component in Bartik was committed.
Comment #56
LewisNymanI compared the two patches and they seem to be very similar. So setting back to RTBC.
Comment #57
alexpottWhy are we introducing the .sidebar--first and .sidebar--second classes but not a .featured-bottom? This change seems to be unnecessary to complete the task of the issue and out-of-scope.
Comment #58
DickJohnson CreditAttribution: DickJohnson commentedFixed the issues mentioned by @alexpott in #57.
Comment #59
idebr CreditAttribution: idebr commentedThe id's were updated to classes since our CSS coding standards dictate id's should not be used to styling when a class can used instead. The patch doesn't touch any css from #featured-bottom, so the id is not converted. If this is out of scope, the updated patch in #58 addresses this feedback appropriately.
Comment #61
idebr CreditAttribution: idebr commentedReroll after #2398461: Clean up the "comments" component in Bartik was committed.
Comment #62
LewisNymanThe reroll looks good!
That is correct, this issue is mainly about moving CSS into the correct component files so they can then be cleaned up.
Comment #63
joshtaylor CreditAttribution: joshtaylor commentedhttps://www.drupal.org/node/1273052 has broken the last patch, with core/themes/bartik/css/layout.css not applying any more.
Comment #64
emma.mariaThanks for pointing that out @joshtaylor! Tagging the issue.
Comment #65
idebr CreditAttribution: idebr commentedMerged in the change from #1273052: Footer container contents are wider than other page elements in Bartik.
Comment #66
LewisNymanReroll looks good!
Comment #68
idebr CreditAttribution: idebr commentedReroll after #2289917: Convert "messages" page element into blocks was committed.
Comment #69
LewisNymanReroll looks good!
Comment #70
webchickCommitted and pushed to 8.0.x. Thanks!