Steps to reproduce
On a right-to-left wiki (I'm on fa.wikipedia), open an article whose reference list mixes Persian and English sources. Some footnotes are written as plain <ref>...</ref> with the citation typed by hand — very common for English books and journals — and others use citation templates.
A live example is the footnotes section of https://fa.wikipedia.org/wiki/ایران_صفوی — roughly half of them are hand-written English citations. A narrower and more demonstrative example has been created at https://fa.wikipedia.org/wiki/User:Huji/T432544
What actually happens
Every item in the reference list (ol.references > li) inherits the page direction (dir="rtl"). So a footnote whose content is English gets laid out right-to-left:
- the leading/trailing punctuation may end up on the wrong side (a citation that should read Blake, Stephen P., ed. (2013), ... may render with its comma and period displaced), and
- the whole entry is right-aligned, so the footnote number and the ↑ backlink sit on the right while the Latin text starts on the left — visually disconnected and hard to read.
What I'd expect
Each footnote should be laid out according to the direction of its own content: an English citation LTR (number and text on the left), a Persian citation RTL — the way a mixed-language bibliography normally looks. This is essentially what the HTML dir="auto" attribute is for.
Why it matters
This isn't specific to Persian — it affects every RTL wiki (Arabic, Hebrew, Persian, Urdu, …). Citing foreign-language (usually English) sources is extremely common, and today those citations are noticeably broken in the reference list. An editor has no practical way to fix an individual hand-written <ref> other than manually inserting bidi control characters, which almost nobody does.
While a dir="ltr" or dir="rtl" workaround exists, many times people import text and references from another wiki (e.g., form English Wikipedia to Persian Wikipedia) and manually adding the dir attributes is too much work and editors skip it. The proposed dir="auto" solution will eliminate the need for ltr or rtl values for the dir attribute of ref tags in most cases to be hard coded.
The subtle part (so whoever picks this up doesn't hit the same wall I did)
I prototyped a fix and there's one gotcha worth recording:
- Putting dir="auto" on the whole <li> does not work, because the list item begins with the localized backlink label (on fa it's the accessibility text «پرش به بالا به:», i.e. "Jump up to:"). dir="auto" keys off the first strong character, so that Persian label makes an otherwise-English footnote resolve to RTL. It shows up specifically on references that are cited more than once (where the label is present).
- Detecting direction from the reference content — the .reference-text span, which excludes the backlink label — gives the correct result. But the footnote number is the <ol>/<li> marker, so to also place the number on the correct side, the detected direction needs to land on the <li> itself (or the markup needs to be arranged so the backlink label doesn't participate in the auto-detection).
I'll leave the exact implementation to the Cite maintainers — I mainly want the label-pollution gotcha on the record so a dir="auto"-on-<li> patch doesn't get shipped and then regress multiply-cited refs.
Current workarounds, and why I'm filing upstream
On fa.wikipedia we can make template citations behave by having our CS1 module emit <cite dir="ltr"> and matching it in Common.css with ol.references > li:has(cite[dir="ltr"]). But hand-written <ref> tags emit no such marker, and CSS can't derive direction from content, so they can't be targeted that way. The only local fix that covers them is a few lines of site JavaScript adding dir="auto" to .reference-text — and one of our interface admins reasonably pushed back that a per-wiki JS workaround is the wrong place for this and it should be handled in the Cite extension. I agree, which is why I'm reporting it here.
Related
- T300053 (bidirectionality guidelines)
- T375975 (reduce reliance on hidden direction marks in MediaWiki)
- T38032 (reference number bidi isolation)
Thanks!
— Mamouri (fa.wikipedia)