Skip to content
Skillpedia
Websites & UI (frontend)75k · #2816

direction-attribute

What it does

This skill checks that a web page sets the right text direction for its language. It is for developers building sites in right-to-left languages or with mixed-direction content.

When to use it

  • ✓When your site adds Arabic, Hebrew, Persian or Urdu content.
  • ✓When user names or comments mix left-to-right and right-to-left text.
  • ✓When menus and layouts look backwards for right-to-left readers.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/direction-attribute/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/direction-attribute/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Can you check that my site displays correctly for Arabic readers?”

5 new skills a week. 1 minute to read.

How it works

The agent checks the dir attribute on the page and on mixed-direction parts, such as user comments. It suggests adding the correct value or an isolation tag where needed.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Set text direction for RTL languages

Without proper dir attributes, RTL text displays incorrectly, UI elements appear backwards, and screen readers announce content in the wrong order.

Quick Reference

  • Set dir="rtl" on <html> for Arabic, Hebrew, Persian, Urdu
  • Use dir="auto" for user-generated content
  • Combine with CSS logical properties (inline-start, inline-end)
  • Test UI mirroring for navigation, icons, and layouts
  • Use bidi isolation such as <bdi> for inline mixed-direction user content

Check

Verify that this HTML document uses the appropriate dir attribute to indicate text direction for right-to-left languages like Arabic, Hebrew, or mixed content. Check user-generated inline text for dir="auto" or bidi isolation where names, handles, or snippets mix writing directions.

Fix

Add the dir attribute to the html element or specific elements with values 'ltr' (left-to-right), 'rtl' (right-to-left), or 'auto' for automatic detection. Use <bdi> or equivalent bidi isolation for mixed-direction inline content.

Explain

Explain how the dir attribute helps browsers and screen readers properly display and navigate text in different writing directions.

Code Review

Review templates, server-rendered HTML, and shared components that output markup related to Set text direction for RTL languages. Flag exact elements, attributes, and routes where the rendered HTML violates the rule. Inspect user-generated inline content, not only page-level locale wrappers.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/html/direction-attribute

FAQ

What does the dir attribute do?

It tells the browser which way text should flow, either left to right or right to left.

What is bidi isolation?

It keeps mixed-direction text, such as a name in another script, from disturbing nearby text. The skill suggests the bdi tag for this.

Does it cover layout mirroring?

The skill suggests testing whether navigation, icons and layouts mirror correctly.

Details

Original description by the author

Use when reviewing templates, rendered HTML, or shared components related to Set text direction for RTL languages. Validate the final browser-facing markup, not just the source framework abstraction.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#2816
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills