Skip to content

Feature request: Add RTL-sensitive value properties list #1772

@lifeiscontent

Description

@lifeiscontent

Summary

It would be helpful to have a list of CSS properties whose values need to be flipped/mirrored in RTL (right-to-left) writing modes.

Use Case

CSS-in-JS libraries generating RTL stylesheets need to know which properties have values that should be mirrored. For example:

/* LTR */
text-align: left;
float: left;
transform: translateX(10px);

/* RTL - values need flipping */
text-align: right;
float: right;
transform: translateX(-10px);

Current State

There's no indication of which properties have direction-sensitive values that need transformation in RTL contexts.

Proposed Enhancement

Add an rtlValueFlip or directionSensitive field:

{
  "name": "text-align",
  "directionSensitiveValues": true,
  "rtlValueMap": {
    "left": "right",
    "right": "left"
  },
  ...
}

{
  "name": "float",
  "directionSensitiveValues": true,
  "rtlValueMap": {
    "left": "right",
    "right": "left"
  },
  ...
}

{
  "name": "clear",
  "directionSensitiveValues": true,
  ...
}

Or a simpler list of properties:

{
  "rtlSensitiveProperties": [
    "text-align",
    "float",
    "clear",
    "background-position",
    "background-position-x",
    "transform-origin",
    "perspective-origin",
    "object-position"
  ]
}

Affected Properties

Properties with direction-sensitive values:

  • text-align (left ↔ right)
  • float (left ↔ right)
  • clear (left ↔ right)
  • background-position, background-position-x
  • transform-origin, perspective-origin
  • object-position
  • Various transform functions (translateX values need sign flip)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions