Problem/Motivation
This drupal.org documentation page describes many common pitfalls of Drupal module's CSS: http://drupal.org/node/1887918#pitfalls
Proposed resolution
To remove these problems, we should follow the best practices guidelines outlined on this drupal.org documentation page: http://drupal.org/node/1887918#best-practices
Remaining tasks
Create an issue for each component and fix them. Here is a proposal of how we could architect the module CSS:
Global utilities
- layout [.clearfix, .inline-x, .nowrap, .float-start/end ]
- js [js-show]
- text [align-start/center/end]
- accessibility [visually-hidden]
See: #2395853: Split system.module.css and system.theme.css files into SMACSS style components
Layouts
- form layout (label positioning, above/left)
- node-form [some or all moved to Seven theme?]
Components
- Entity Meta - #2408463: Rewrite entity-meta component inline with our CSS standards
- Field UI - #2408469: Rewrite field ui components inline with our CSS standards
- Details #js
- Icons
- Spinners [throbber]
- Progress #js
- Buttons #js → [for dropbuttons]
- Button-groups
- Popups #js
- Menus #js [application-style menus, not navs]
- Media-block [see bit.ly/cCY3Ew]
- Tabs
- Vertical tabs
- slats [?? see http://pea.rs/content/slats-text-only]
- messages [note tables and forms have inline status states/messages] - #1591744: Clean up CSS and markup for status report
- modal #js
- pager
- breadcrumb
- book-nav [footer navigation for book module] - #2405445: Refactor book module CSS files inline with our CSS standards
- ckeditor
- comments
- search results [??]
- password strength thing
- form-field [container for label, input, prefix/suffix like Twitter Bootstrap, plus description & inline error]
- input-text [all text-like inputs, incl. textarea]
- input-select
- input-radio
- input-checkbox
- input-search
- input-file [?? wrappers?]
- autocomplete ← extends or includes textfield, popup, menu, spinner #js
User interface changes
None. The design objects that style the Drupal module's functionality should be look roughly the same after as they do now.
API changes
All of core's modules will have new CSS selectors that better match the design objects being used for their content.
Related Issues
Tasks
#2012020: Complete a survey of 3rd party resources to aid with component naming conventions
#2003742: Refactor nested side menus with new component-style selectors
#2006496: Refactor tabs with new component-style selectors
Comments
Comment #1
echoz commentedComment #1.0
echoz commentedadded #2003742
Comment #1.1
echoz commentedadded #2006496
Comment #2
ry5n commentedI’ve gone through core and referred to the Seven Style Guide and come up with a starting list o fstuff that we should examine to abstract out our design objects. Stuff listed under building blocks is pretty well modularized; other stuff may not be.
Core CSS
Potential abstractions (base/layout/components)
- these abstractions may or may not currently exist in core
- #js == component will need JavaScript attached
- notes are in [square brackets]
utilities
- layout [.clearfix, .inline-x, .nowrap, .float-start/end ]
- js [js-show]
- text [align-start/center/end]
- accessibility [visually-hidden]
layouts
- form layout (label positioning, above/left)
- node-form [some or all moved to Seven theme?]
components
- details #js
- icons
- spinners [throbber]
- progress #js
- buttons #js → [for dropbuttons]
- button-groups
- popups #js
- menus #js [application-style menus, not navs]
- media-block [see bit.ly/cCY3Ew]
- tabs
- vertical tabs
- slats [?? see http://pea.rs/content/slats-text-only]
- messages [note tables and forms have inline status states/messages]
- modal #js
- overlay #js
- pager
- breadcrumb
- book-nav [footer navigation for book module]
- ckeditor
- comments
- search results [??]
- password strength thing
forms/
- form-field [container for label, input, prefix/suffix like Twitter Bootstrap, plus description & inline error]
- input-text [all text-like inputs, incl. textarea]
- input-select
- input-radio
- input-checkbox
- input-search
- input-file [?? wrappers?]
- autocomplete ← extends or includes textfield, popup, menu, spinner #js
Seven Theme
components/
- grid system [requires abstracting from current layouts]
- admin-table
- admin-table--draggable #js
- typography
- content header
- link [for styling buttons as links]
- panel [island object; base for details/fieldset appearance]
- captioned nav [e.g. admin/ or variant at admin/config] ← could be built on slats (see above)
- well [inset style; needed??]
Complex UIs
We should be able to build many of Core’s complex user interfaces using
the basic components above, plus custom components in Seven.
Idea: define a base theme from which Seven inherits markup/css/js required for
all Drupal admin themes.
Complex UIs:
- diff [core/modules/system/css/system.diff.css]
- admin filters [in filters.module; what is this?]
- admin exposed filters [in system.admin.css; what is this?]
- admin modules ui
- admin views ui
- admin blocks ui
- admin color ui
- admin image ui [styles, etc.]
- admin locale ui [in locale module. What is this?]
- admin layout ui [SCOTCH stub??]
- admin theme settings ui
- admin node edit ui
- admin field ui
- admin taxonomy ui
- admin entity translation ui
- admin update ui
- admin shortcut button
- admin contextual links
- admin inline edit ui
- admin toolbar
- admin db log
- admin simpletest results
- admin tour
- forum module [??]
- help module
- openid login [??]
Comment #3
ry5n commentedFor an idea of how this could potentially get structured as files, see #1663622-54: Change directory structure for JavaScript files.
If we go all the way on this, we might end up pulling almost all CSS out of core/modules. What this would be is our own front-end framework, used by modules but no longer split up within them. The last piece would be Twig + theme functions for matching markup, and we have would #1804488: [meta] Introduce a Theme Component Library.
Comment #3.0
ry5n commentedAdd link to the Seven Style Guide sandbox.
Comment #4
adubovskoy commentedGood task for CodeSprintCIS
Comment #4.0
adubovskoy commentedAdded new sub-task.
Comment #5
lewisnymanComment #6
lewisnymanMoving this into core
Comment #7
lewisnymanMoved a lot of Ryans comment into the issue summary
Comment #8
lewisnymanComment #9
lewisnymanComment #10
lewisnymanComment #11
lewisnymanComment #12
lewisnymanComment #13
lewisnymanComment #14
lewisnymanComment #15
hass commentedComment #16
lewisnymanYou can now view a webpage of all the errors in all the CSS files in core :) http://lewisnyman.co.uk/drupalcore-frontend-toolkit/
Comment #17
lewisnymanComment #18
davidhernandezLewisNyman++ that's very nice. Maybe link that in the theme docs somewhere?
Comment #30
quietone commentedAdd parent.