Skip to content

An icon that points against its button

rtl-icon-rolemoderate
On this page

Why it matters

  • Arabic text runs from right to left, so "next", "more" and "continue" point left, and "back" and "previous" point right.
  • People read an arrow before they read the word beside it. A "next" arrow that points right looks like "back", and visitors press the wrong control in carousels, numbered pages and steps.
  • Icon libraries and sliders draw their arrows for English pages, and the browser does not mirror them by itself.

Example

Wrong
<a href="/offers" class="next">التالي <span class="icon-arrow-right"></span></a>
Right
<a href="/offers" class="next">التالي <span class="icon-arrow-left"></span></a>

How to fix

  • Mirror the icon on Arabic pages, or use the opposite icon:
css
[dir='rtl'] .icon-arrow-right,
[dir='rtl'] .icon-arrow-left {
  transform: scaleX(-1);
}
  • Or swap the icon in the Arabic template: a left arrow for "next", a right arrow for "back".
  • Keep what does not follow the reading direction as it is: a play button, a clock, a picture of a real object.

How we detect

  1. We render the page and look, in controls whose computed direction is right to left, for a role in their label (aria-label, title or text), their rel, or their class: «التالي», «المزيد», «next», «السابق», «رجوع», «back» and the like.
  2. We look in the control for an icon whose direction is known: a Font Awesome, Bootstrap Icons or Lucide class such as fa-arrow-right, a Material name such as chevron_left, an SVG named in a <use> or a data attribute, or an arrow character «→» «←».
  3. We turn the icon by a mirroring transform on it, on its ::before or ::after, or on up to three ancestors, and by a stylesheet that makes the opposite icon draw when the page is read from right to left.
  4. We report a control when every icon in it points against its role. A control with no icon of known direction, one whose label has both roles, or one with direction left to right, is not judged.