Suggested commit message
git commit -m 'Issue #2419475 by pjbaert, DickJohnson, emma.maria, Luxian, LewisNyman, tadityar, idebr, floretan, lauriii: Clean up the "Featured bottom" component in Bartik '
Problem/Motivation
Bartik's code needs to meet current Drupal coding standards.
Proposed resolution
This issue takes a specific section of Bartik's code, it acts as a "component" issue and improves that section of code with minimal impact on the rest of Bartik's codebase.
This issue aims to clean up and properly format the CSS and templates files without breaking Bartik visually.
This issue primarily looks at the css/components/featured-bottom.css file.
Work that needs to be included in patches for this issue are fully outlined in the META issue #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
| 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 |
|---|---|---|---|
| #45 | clean_up_the_featured-2419475-45.patch | 5.15 KB | lewisnyman |
| #45 | interdiff.txt | 1.23 KB | lewisnyman |
| #32 | interdiff-28-32.txt | 1.95 KB | tadityar |
| #32 | bartik-clean-featured-bottom-2419475-32.patch | 4.46 KB | tadityar |
| #30 | interdiff-bartik-23-28.txt | 4 KB | pjbaert |
Comments
Comment #1
idebr commentedI don't think there currently is a
css/components/featured-bottom.cssfile in Bartik. Is this a followup for an issue that is currently being worked on?[edit] This issue is a followup for #1164784: “Triptych” term is not widely understood; add "Featured top" and "Featured bottom"
Comment #2
idebr commentedComment #3
idebr commented#1164784: “Triptych” term is not widely understood; add "Featured top" and "Featured bottom" has been committed, so this issue can now be worked on
Comment #4
DickJohnson commentedStarted to work on this. Replaced id's from templates with classes and matched CSS with this change.
Sending to testbot.
Comment #5
DickJohnson commentedFixed coding standard issue.
Comment #6
emma.mariaThe latest patch breaks featured-bottom visually in a big way. Can we fix this? Then I will suggest further changes to the CSS.
The layout is broken as we have two declarations of class and we lose the second one with clearfix. Need to combine and keep the clearfix class please.
Comment #7
emma.mariaComment #8
emma.mariaComment #9
harshil.maradiya commentedHi Emma,
I have applied this patch on my system but not able to reproduce this issue as per attached screen shot
would you please provide exact step to reproduce.
As per #6 it is already fix in #5
Please let me know if you need more information on same .
Thanks & Regards
Harshil Maradiya
Comment #10
DickJohnson commentedComment #11
DickJohnson commentedRerolled this. Changed also the class-structure to be similar than it is in featured-top -component.
After the patch has been applied, featured-bottom looks like:

Comment #12
DickJohnson commentedComment #13
emma.mariaThe grey background no longer stretches across the full width of the screen.
Comment #14
emma.mariaComment #15
kyuubi commentedHi,
I have tested patch #11 and I cannot replicate issue state in #13.
The bars go full with.
Attaching screenshot.
Comment #16
idebr commented@kyuubi The issue mentioned in #13 is correct and is also visible in your own screenshot. For a comparison I made a before/after screencap:
Comment #17
emma.mariaComment #18
emma.mariaComment #19
pjbaertI rerolled this.
I couldn't find fix the issue as mentioned in #13 yet, but I'll try to work on that later this week.
Comment #20
pjbaertWell let's add the files then...
Comment #21
emma.mariaFiring testbot to check the patch
Comment #22
emma.mariaComment #23
pjbaertI updated the patch & fixed the bug mentioned in #13.
The grey background stretches back across the full width of the screen.
Comment #26
pjbaertPatch passed after re-testing.
Comment #27
emma.mariaCode review.
I noticed a few issues.
.featured-bottom-innerneeds to be changed to.featured-bottom__innerto represent a descendant of the featured-bottom component using BEM markup. See the featured-top markup for examples. Also this is a great article to explain it http://csswizardry.com/2013/01/mindbemding-getting-your-head-round-bem-syntax/There are so many declarations of the above selectors. As it is declaring all of the regions in featured-bottom we can just say
.featured-bottom .regioninstead.Comment #28
pjbaertThanks for the feedback @emma.maria
I processed the remarks you mentioned in #27.
Comment #29
pjbaertComment #30
pjbaertSeems like I forgot to add the interdiff...
Comment #31
idebr commented@pjbaert Great changes, thanks :)
Some things I noticed:
The last 0 can be removed, as it is infered by the first value, eg. padding: 0 20px;
Is it possible to rewrite the id selector to a class? The CSS guidelines highly discourage the use of using ids for styling, because of its specificity.
Instead of extending the selector, apply the class 'layout-container' to the html to apply its styling. This makes for much cleaner css selectors and maintenance.
There's 2 spaces between the selector and the {. The CSS coding standards mandate a single space, eg. .featured-bottom {
Let's place each selector on a new line instead of creating one long line.
Comment #32
tadityar commentedCreated a patch addressing 1,3,4, and 5. Other css files still uses ID for block thingy, should we change it or leave it as is?
Comment #33
idebr commented@tadityar Thanks for working on this issue! We should definitely try to rewrite it unless there is a valid reason to leave it.
I noticed a regression in the latest interdiff:
The class .featured-bottom__inner was removed in your patch, but it is still referenced in the complete patch file as a selector.
Comment #34
emma.mariaI also noticed the following...
These classes are currently not in Core so they are doing nothing. I'm not sure how long this has been the case but I suppose we should fix this code.
.featured-bottom-second.featured-bottom-thirdComment #35
pjbaertPosting a small update here:
All
featured-bottom__innerreferences are updated tolayout-containerI noticed that there was no use for the above code snippet
Since this part beneath was overruling it (see attached screenshot):
So a short recap of what we still need to do:
1. Rewrite the id selectors to a classes (mentioned in #31)
2. fix this code of these classes who aren't in Core. (see #34)
.featured-bottom-second.featured-bottom-thirdComment #36
pjbaertComment #37
emma.maria.layout-containeris only used to define the grid on the page and it is added to every section of Bartik. We should not use that selector to style any specific elements. Take a look at page.html.twig to see it's use. Please put back.featured-bottom__inner.Comment #38
LuxianChecking this issue.
Comment #39
LuxianHere is a new patch. I've changed the
.layout-containerselector used insidefeatured-bottom.cssto.featured-bottomand things didn't break. Classfeatured-bottom__innerit's not needed and I left it out.Comment #40
LuxianComment #41
emma.mariaWe are almost there! Just a few more things to improve.
We need to replace all instances of IDs with sensible classes found on all of the blocks mentioned above.
do not exist in the markup.
Please replace with the current existing classes...
etc.
Comment #42
floretan commentedLooking into it, the IDs mentioned in the first point of #41 are not there anymore, and for some of them there are no usable classes or IDs to replace them. We would need to add them somehow before the CSS code can work again.
Comment #43
emma.mariaI have fixed the last parts of the file that I pointed out in #41. I have listed the reasoning for the changes I added below to help.
Instead of declaring widths on many inputs we should just say all form inputs that are not buttons should print at that width,
The user online block no longer prints p tags.
We have changed how the feed icon works, it is now uses text replacement so text-align:right breaks this. So instead I targeted the icon specifically to float right.
We have had other issues in Core which removes the forceful hiding of block titles with CSS. Therefore I removed this code, users can use block settings instead.
Removed this purely because it doesn't look right when put alongside other blocks with text in. Removed with recommendation from lewisnyman.
Also note that I have added a block class suggestion to Classy's and Bartik's block Twig template on recommendation from lauriii and lewisnyman. Some blocks that are provided by Drupal on install such as the Powered by block have no usable classes out of the box.
This is what you are given out of the box right now:
<div id="block-poweredbydrupal-2" class="contextual-region block block-system" role="complementary">A beginner suggested that I should just use the ID. Which is bad bad bad! The current markup will definitely encourage bad practices.
Therefore I added the following variable to the Set Classes array in the block template...
'block-' ~ plugin_id|clean_class,and it worked perfectly for what I needed, which was a class for the block that could be used no matter how many instances of the block on the page or where it was positioned.
Comment #44
lewisnymanWe can remove all color properties that are being used as fallbacks for rgba properties because we no longer support browsers that do not support rgba.
I think we can remove border-box from here as we aren't setting a width on mobile. border-box is already applied on desktop
In most files I think we also add em to the end of line-height declarations.
We can remove .block from these selectors and they seem to work the same
Comment #45
lewisnymanComment #46
lauriiiI give +1 for this class being added. Without this theming blocks is almost impossible because there is no existing class to match all the instances of specific block plugin.
Anyway the patch fixes the problem that is being fixed in the parent meta issue. There is no blocks by default set to the featured bottom regions but I tested adding some random blocks with different combination and the functionality has remained the same as before the patch.
Comment #47
emma.mariaSuggested commit message
git commit -m 'Issue #2419475 by pjbaert, DickJohnson, emma.maria, Luxian, LewisNyman, tadityar, idebr, floretan, lauriii: Clean up the "Featured bottom" component in Bartik 'Comment #48
alexpottCommitted 3a0002f and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.