Skip to content

YAML5: Use HTML 'dir' attribute in CSS files #23

@alexhass

Description

@alexhass

Next Drupal 8 (release end of year 2013) has a changed approach for integrating RTL support. See below linked case for reasons and the final committed patch in #69 that has tons of example how code need to be changed.

Remove language_css_alter() (RTL stylesheets) in favor of HTML 'dir' attribute: https://drupal.org/node/2015789

Some of the key benefits are

  1. half number of CSS files (all "-rtl.css" files are removed)
  2. increases the maintainability
  3. easier SASS integration
  4. better code readability

Examples:

body {
  margin: 1em;
  background-color: #fff;
}
[dir="rtl"] body {
  direction: rtl;
}

th {
  text-align: left; /* LTR */
  color: #006;
  border-bottom: 1px solid #ccc;
}
[dir="rtl"] th {
  text-align: right;
}

For the reason that the incremental files (-rtl.css) are no longer working in Drupal 8 we really need to change this. I like this change as it makes code really easier to read as the RTL comes directly after the LTR specification. No need to search around if the RTL override exists or not and so on. It's really a lot easier.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions