R021: Unisolated bidi hazards: phones, emails, Latin tokens inside Arabic text
In right-to-left text a phone number like +966 55 123 4567 displays as 4567 123 55 966+ unless it is isolated in <bdi>, and figures with brackets or signs can flip the same way.
The check
- Id
- R021
- Category
- Direction and bidi
- Default severity
When it fires
medium confidence
A visible element's own text mixes Arabic with a phone number, an email address, or a Latin run that will reorder: one holding a digit, bracket, sign or percent, like
iPhone 15or+15%, or two or more words ending in punctuation. A lone Latin word such as a brand name renders where it is written and is not reported.Fix: Isolate each token:
<bdi>token</bdi>or<span dir="ltr">token</span>. Keep phone numbers LTR.low confidence
An element with no Arabic in it, inside right-to-left text, holds a phone number, an email address, or a number with a bracket, sign or percent against it, like
26K (-12.4%). The bidi algorithm resolves those characters against the paragraph, so their order can flip. Whether it does depends on what surrounds it, so this reports at low confidence.Fix: Isolate each token:
<bdi>token</bdi>or<span dir="ltr">token</span>. Keep phone numbers LTR.
What it leaves alone
Text that is already isolated: a <bdi>, an element with its own dir attribute, or text using bidi control characters. Also code blocks and non-Arabic lang contexts. Brand names are set aside before the Latin runs are read.
Broken, then fixed
<p>للتواصل: +966 55 123 4567</p><p>للتواصل: <span dir="ltr">+966 55 123 4567</span></p>Check it by hand
Run document.body.insertAdjacentHTML('afterbegin', '<p dir="rtl">+966 55 123 4567</p>') in the DevTools console: the number displays as 4567 123 55 966+, its groups in reverse. Wrapped as <bdi>+966 55 123 4567</bdi> it keeps its order. Swap in text from the page to test your own.
What the report shows you
Each R021 finding carries the fields below that apply to it, so you can see why it fired without rerunning the scan.
- hazards
- Each token found, with its kind: a phone-like number, an email, a Latin run beside Arabic, or a numeric run with bracketing punctuation.
- sample
- The element's text, cut to 160 characters.
Components that pass it by construction
These Ritla UI components satisfy R021 by how they are built. Used as documented, they do not bring this defect onto your page.
More direction and bidi checks
Does your page trip R021?
Paste a URL. Ritla renders the page on desktop, tablet and mobile, runs every check, and shows the top issues with screenshot evidence.
Scan a page freeBrowse the checks