Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
@mortendk has said this....
".clearfix
class is a layout fix that cause of its visual nature should not really be in classy - it should be added to themes that need them (ex bartik & seven) clearfix have its uses but will be forgotten when flexbox gets to be introduced to the world, it seems kinda stupid to carry that with us around."
Proposed resolution
Discuss if we should remove 'clearfix' classes from Classy.
Remaining tasks
Discuss and decide on an action
User interface changes
n/a
API changes
n/a
Data model changes
n/a
Comment | File | Size | Author |
---|---|---|---|
#18 | remove_clearfix_class-2544868-18.patch | 5.75 KB | nesta_ |
#7 | interdiff.txt | 771 bytes | cdog |
#7 | drupal-clearfix-2544868-7.patch | 5.71 KB | cdog |
| |||
#2 | drupal-clearfix-2544868-2.patch | 4.79 KB | cdog |
Comments
Comment #1
LewisNymanIf modules are still loading CSS that floats elements, then clearfix is still useful. We don't have a good way of reusing clearfix like we would with Sass.
Comment #2
cdog CreditAttribution: cdog as a volunteer commentedThe attached patch removes all occurences of the
.clearfix
class from Classy. To find the files where it's used you can use the followinggrep
command:Comment #3
Sam152 CreditAttribution: Sam152 commentedHow does flexbox help in this use case? I agree with LewisNyman that clearfix still has a place for clearing non-layout related floated elements.
This particular instance is probably important for making floated image in rich text fields not break layouts.
Comment #4
cdog CreditAttribution: cdog as a volunteer commentedComment #6
cdog CreditAttribution: cdog as a volunteer commented@Sam152 Using flexbox doesn't require floats for aligning elements.
See Using CSS flexible boxes for an explanation and A Complete Guide to Flexbox for a few examples.
Comment #7
cdog CreditAttribution: cdog as a volunteer commentedComment #8
Sam152 CreditAttribution: Sam152 commentedAlthough it might be possible using flexbox, core still uses floats for aligning images in filtered text:
Until that is addressed, blindly removing all the clearfix classes is a regression.
Comment #10
mortendk CreditAttribution: mortendk as a volunteer commented@sam152 .clearfix is a hack and for positioning that could just as easy be added directly to the existing selector.
The problem is that its spread all around the code & makes it harder in the end for a theme to overwrite later, when frontenders for real begins to use flexbox.
instead of adding in a clearfix class that we can't manage directly in the css later, we should add the clearfix methode to the wrapper in the css, then its manageble later from the css without having to remove the clearfix in the template.
Comment #11
cdog CreditAttribution: cdog as a volunteer commentedOk, I'm just trying to give some help and also to start contributing.
@Sam152 Agreed, I've proposed an initial patch which is incomplete. It identifies the
.clearfix
usage and removes it from the markup (without really breaking anything on a default setup).@mortendk Yes, this is missing from the attached patch. The micro clearfix hack should be dirrectly applied on the wrapper elements.
Are any of you at the extended sprints this weekend and interested in discussing a suitable solution?
Comment #12
LewisNymanI still don't know if this is a good idea. Should we discuss it before patching?
Comment #13
cdog CreditAttribution: cdog as a volunteer commentedOk, I'm going to work on something else for now. I've seen @mortendk here at the sprints but he doesn't look very approachable :)) Just kidding, let me know if any of you are available for a discussion in the meantime. Thanks!
Comment #14
mortendk CreditAttribution: mortendk as a volunteer commented@cdog aaaaaw dude you should just have come over and punched me, im sorry i had to leave early.
It might be a bit premature to try to rip it out right now 2 weeks before RC1, but its defo a thing we should look into, or figure out a name things better in the future
but that might be an issue for classy 2
Comment #15
cdog CreditAttribution: cdog as a volunteer commented@mortendk that's fine, I thought myself that's not a priority for now. As a new contributor I start to work on issues that are well defined or somehow isolated. Just le me know when this is ready for work or if there's anything else where help is needed.
Comment #16
nesta_ CreditAttribution: nesta_ at La Drupalera by Emergya commentedUpdate issue status for #7
Comment #18
nesta_ CreditAttribution: nesta_ at La Drupalera by Emergya commentedRerolled #7.
Comment #19
darketaine CreditAttribution: darketaine as a volunteer commentedI'm not sure if this is possible as Classy is a base theme, so it can't be changed anymore. I think that these kind of changes can only happen in non base themes (neither Classy nor Stable) at this state.
Comment #20
Sumit kumar CreditAttribution: Sumit kumar as a volunteer commentedTested patch #18 woring for me clear all clearfix class for classy theme
Comment #21
Sumit kumar CreditAttribution: Sumit kumar as a volunteer commentedComment #22
Sumit kumar CreditAttribution: Sumit kumar as a volunteer commentedComment #23
Sumit kumar CreditAttribution: Sumit kumar as a volunteer commentedComment #24
LewisNymanI'm not sure we can set this to RTBC yet. Have we had a proper discussion at yet? We are adding a lot of repetitive code to maintain, is this a good idea?
Also, we need screenshots of the affected areas to show that we didn't miss anything. How does this change affect Bartik and Seven?
Comment #25
emma.mariaSetting this to a 'Plan' as we need to discuss alternative solutions first before working on patches.
Comment #27
emma.mariaComment #28
catchThis could either happen in 8.x, or it should be won't fix, but I don't see a specific reason to move it to 9.x since the class could be moved to Stable?
Comment #41
quietone CreditAttribution: quietone at PreviousNext commentedDiscussed in #frontend. markconroy suggested that this should be moved to the contrib project. I am doing that now.