Project

General

Profile

Actions

Feature #43506

closed

Declare text direction on HTML element for better RTL/LTR styling support

Added by Go MAEDA 3 months ago. Updated 3 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
UI
Target version:
Resolution:
Fixed

Description

The attached patch sets the DIR attribute on the HTML element according to the current language direction.

For example:

  <html lang="en" dir="ltr">
  <html lang="fr" dir="ltr">
  <html lang="ar" dir="rtl">

This makes it easier for plugins and themes to write direction-aware CSS, such as:

  html[dir="ltr"] .admonition { border-left: 2px solid red; }
  html[dir="rtl"] .admonition { border-right: 2px splid red; }

The change is harmless. In RTL environments, rtl.css already sets html {direction: rtl;}, and browsers use the CSS direction property over the HTML dir attribute for layout. Therefore, adding dir to the HTML element does not change the visual appearance of existing pages, but simply exposes the direction as a reliable hook for additional CSS.


Files

html-dir-attr.patch (1.87 KB) html-dir-attr.patch Go MAEDA, 2025-11-20 10:18

Related issues

Related to Redmine - Feature #43515: Improve RTL layouts by removing rtl.css and integrating its overrides into application.css using CSS logical propertiesClosedGo MAEDAActions
Actions

Also available in: Atom PDF