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.
See: #1995272: [Meta] Refactor module CSS files inline with our CSS standards
Remaining tasks
Review the current CSS — What to look for when reviewing CSS
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#42 | 2408511-interdiff-34.txt | 677 bytes | pjbaert |
#42 | 2408511-42.patch | 11.64 KB | pjbaert |
#34 | 2408511-34.patch | 11.63 KB | rpayanm |
#34 | 2408511-interdiff-26.txt | 689 bytes | rpayanm |
Comments
Comment #1
LewisNymanComment #2
LewisNymanComment #3
joaogarin CreditAttribution: joaogarin commentedThere is some dependency to elements like summary or strong which would be nice to avoid so that these elements could be for example replaced by another element and not getting the layout broken but that would require some HTML modifications to the vertical tabs
Comment #4
LewisNymanYeah that's what I'm thinking. Currently we have:
My suggestion would be:
Comment #5
joaogarin CreditAttribution: joaogarin commentedYes I like the structure and the naming is much more clear. The fact that right now the list item is called "vertical-tab-button" does not make any sense at all.
Regarding the anchor if it really differs from a general anchor than it would need a class (which could actually be the .vertical-tab__menu-item__button) Looks a bit overdoing it but really its something that can help in case for example some theme wants to extend seven.
Not sure if that is something that for some reason might be more complicated. I will look a bit into this code to get a more clear perception of it.
Comment #6
joaogarin CreditAttribution: joaogarin commentedHello,
Making a patch of this issue. I tested in all themes (classy, bartik and seven).I actually made the changes to the following files :
core/misc/vertical-tabs.js
core/themes/seven/css/components/vertical-tabs.css
core/misc/vertical-tabs.css
core/themes/bartik/css/components/vertical-tabs.component.css
I actually had to maintain ul.vertical-tabs__menu in the Bartik override for some reason as stated in the comment that was already there. It needs to override .region-content ul
I added the following naming as suggested :
And added also these :
And changed changed some modifiers.
I am attaching some screens, please review. Also I am not sure about the naming of the patch file I put the project name as "drupalcore".
Comment #7
joaogarin CreditAttribution: joaogarin commentedHello,
Just making a minor fix to the latest patch there where some "strong" elements that where still not using the proper class name.
Please take a look at line 25 of the js script. I changed this class there but I am not sure about it.
I tested and it seemed okay, also without JS (the default "detail" elements rendered okay).
Comment #8
LewisNymanGreat work! I went of the CSS in all the themes and found a few optimisations we could make.
We need a full stop at the end of this comment.
We also need a full stop here
It looks like we can remove these properties as they don't do anything
'Component' should be lowercase, we also need a full stop here.
We can remove the element from this selector
These three properties don't see to do anything
We can remove text-decoration: none from the links as that is the default styling
Comment #9
joaogarin CreditAttribution: joaogarin commentedfor some reason in Bartik theme I cant remove the element from the selector or it gets overriden.
I will try again and provide some screens.
Comment #10
joaogarin CreditAttribution: joaogarin commentedHello,
I am attaching a patch with these fixes. On the bartik theme I had to put the following selector :
.vertical-tabs .vertical-tabs__menu
otherwise it would be overriden with the .region-content ul selector and misplace the tabs adding a different margin.
I am also attaching some images.
Also by removing the
text-decoration: none;
from the :hover effect it now has a underline effect on hover but I guess that is also common behaviour?
Comment #11
idebr CreditAttribution: idebr commented@joaogarin Thanks for working on this; it is looking much better already!
Yes, this is fine. The selector already has a comment mentioning the selector is overqualified:
/* This is required to win specificity over [dir="rtl"] .region-content ul */
The proposed resolution for this patch is to leave the design as is, but only update the CSS in line with our coding standards. The text-decoration is also currently in line with the style guide for Seven, so let's leave it as is currently in HEAD.
Otherwise, this seems ready to go :)
Comment #12
LewisNymanSeems like this one-line change is a novice task
Comment #13
pjbaertComment #14
pjbaertI added the 'text-decoration: none;' line.
Comment #15
pjbaertComment #16
geertvd CreditAttribution: geertvd commentedFeedback in #11 has been taken care of, I think this can go to RTBC.
Comment #17
alexpottShouldn't this class be prefixed by
js-
because it is javascript only. Also is actually needed can't we just use[data-vertical-tabs-panes]
Also this appears to be javascript only. Isn't all of vertical tabs JS only? Perhaps we should be thinking about #2431671: [meta] Add in js- prefixed classes for separation of JS & CSS functionality
Comment #18
joaogarin CreditAttribution: joaogarin commentedYes the vertical tabs are really js only so I guess adding a js prefix is not a bad idea at all!
I will try to have a look into this today or tomorrow and get a patch here.
Comment #19
LewisNymanAlso see the discussion in #2278473: Simplify Dropbutton markup in line with our CSS standards:
The coding standards provide specific directions on this:
Which means, if we need a class for js functionality, we should use a new class that is only used for functionality, not just adapt the classes we use for styling. We shouldn't have any .js- prefixed classes in stylesheets.
Comment #20
LewisNymanIf javascript is adding a class for styling purposes, then it should not be prefixed with .js-, if it adds a class for functional purposes, then it should be prefixed with .js (or a data attribute)
Comment #21
joaogarin CreditAttribution: joaogarin commented;) good.
So can you can check the patch to see if there is something missing? I will take another look as well to see if something comes up
Comment #22
joaogarin CreditAttribution: joaogarin commentedHad a look into #14. Look good to me
Comment #23
krisp1 CreditAttribution: krisp1 commentedInvestigating this @ Drupal South.
Comment #24
krisp1 CreditAttribution: krisp1 commentedPatch #14 applied without error. Now I must study the new CSS coding standards in depth .
Comment #25
joaogarin CreditAttribution: joaogarin commentedHello,
I applied the patch just two days ago and It was okay. I will give a crack at it today as well to see if its okay.
My brother is in @ Drupal South nickname kyuubi! Have fun =)
Comment #26
joaogarin CreditAttribution: joaogarin commentedresubmitting #10 with that extra one line of text-decoration: none;
Comment #27
LewisNymanOk, this is looking good! I've attached some screenshots from Seven, Bartik, and Classy.
We can remove the .vertical-tabs class from these selectors
Comment #28
Maninders CreditAttribution: Maninders commentedThis issue is looked resolved, changing status from needs work to needs review.
Comment #29
Maninders CreditAttribution: Maninders commentedAdding SprintWeekend2015 tag.
Comment #30
LewisNyman@Maninders The comment in #27 is not resolved
Comment #31
Anonymous (not verified) CreditAttribution: Anonymous commentedI'll make this cleanup fix.
Comment #32
Anonymous (not verified) CreditAttribution: Anonymous commentedI have cleaned css selectors. Please review.
Comment #33
LewisNymanThe latest patch is missing the changes from the patch in #26
Comment #34
rpayanmComment #35
LewisNymanNice, thanks for all the hard work in this issue.
Comment #38
rpayanmBack to RTBC.
Comment #39
alexpottManually tested - looks like nothing has changed which is great. However considering we are renaming all the classes here I think we should be prefixing them all with
js-
as per the standards.Comment #40
LewisNyman@alexpott the standards state that
js-
prefixes should only be used when they are required for JS functionality. If a class is added with Javascript for styling purposes than it should not be prefixed withjs-
. There should be nojs-
prefixed classes in CSS:We are already using a data attribute to initialise JS functionality
Comment #41
alexpott@LewisNyman - ah good - thanks for letting me know that - makes complete sense to me. I think other issues have been attempting to add js- to classes incorrectly then. I'll be on the look out. Given that all the browsers we support also support data attributes should we ever see any js- classes?
Needs a reroll.
Comment #42
pjbaertRerolled the patch.
Comment #43
LewisNymanThe reroll after #2348321: Upgrade to jQuery Once 2.x looks correct. Thanks!
Comment #47
rpayanmAgain
Comment #48
LewisNymanI am unsure on the official policy, but it seems that the preference is data attributes where possible: #1090592: [meta] Use HTML5 data-drupal-* attributes instead of #ID selectors in Drupal.settings #2180921: [META] Use data attributes rather than classes wherever possible
Comment #49
alexpottCSS and JS is not frozen in beta. Committed e73ce6e and pushed to 8.0.x. Thanks!
Comment #51
nod_Comment #52
idebr CreditAttribution: idebr commentedThis change is unintended (see #11.2) and introduced a regression where vertical tabs text is underlined in the hover/focus/selected state. I have opened a followup at #2459607: Seven vertical tabs have underlined links in hover/focus state.