Now :dir() pseudo-class CSS selector is quite well supported through browsers, we should allow its use in templateStyles, safelisting it in CSS-Sanitizer.
Previous report
Currently:
- TemplateStyles prefixes all CSS selectors with .mw-parser-output , so .mw-content-rtl is not usable (because it is applied on a ancestor).
- There is no way to pass variables to styles with some kind of `<templatestyles src="file.css" vars="{lang: {{PAGELANGUAGE}} }" />
- CodeMirror refuses to save text with non-standard :dir(rtl) CSS pseudo-class or float: inline-end rule.
We should have a way to customize CSS rules depending on element language direction. The best would be to support :dir(rtl|ltr), but since only Firefox currently works with it, we would better make .mw-content-rtl / .mw-content-ltr accessible from template style sheets.