Skip to content

Common Tailwind RTL bugs

Diagnose Tailwind RTL spacing, alignment, positioning, transform and float bugs, then verify each fix in both Arabic and English layouts.

By , Founder of Ritla

Guide13 min read

An Arabic rehearsal panel looks correct on a phone, then gains an unexplained left margin on desktop. A popover moves to the intended side but suddenly fills its whole parent. A centered label shifts sideways even though its logical anchor is correct. These are different Tailwind RTL bugs, and adding another rtl: prefix will not fix all of them.

Start with the failing state and inspect the generated CSS. Find the element that owns the position, margin or alignment, then check its direction and the active declarations. The class name is evidence of what the developer requested, not proof of what the browser ultimately applies.

The examples below use a theater rehearsal planner. They assume a correctly declared Arabic document and current Tailwind v4 utilities, with explicit notes where v3 behavior differs. Each component is an isolated reproduction rather than a complete application.

Identify the failing layer before changing classes#

Record the route, viewport, interaction state and installed Tailwind version. Reproduce with the same rehearsal record in English and Arabic. Keep a screenshot and the final class list before making changes.

Use the symptom to narrow the investigation:

SymptomInspect first
Layout is LTR throughoutDocument direction and explicit wrapper overrides
Only a larger breakpoint breaksResponsive physical utilities and resets
Correct side, unexpected popover widthBoth physical insets remaining active
Logical anchor is correct, label is offsetTranslation and its coordinate system
Locally English content receives RTL stylesGenerated direction-variant selector
Spacing changed after an upgradeInstalled version's child-spacing rules
Fix appears in source but has no effectClass generation, then cascade and component defaults

Confirm that the document actually declares dir="rtl", then inspect computed direction on the failing element. Language and alignment are separate from document direction. The W3C document-direction guidance explains that foundation; R001 covers document direction missing, contradicted, or declared only in CSS.

Do not assume every screenshot difference is a defect. The first control in an Arabic reading sequence can correctly appear on the right. Name the intended relationship before deciding that it needs to move.

Spacing breaks only when a responsive physical class activates#

The planner indents a director's note from the reading start. Its base class is logical, but the wider layout still carries an English margin:

Problem

html
<blockquote class="ms-4 border-s-2 ps-4 md:ml-10">  <p>راجع انتقال الممثلين قبل بدء المشهد الختامي.</p></blockquote>

Below the medium breakpoint, the starting margin follows direction. Above it, md:ml-10 assigns a physical left margin. In horizontal RTL, that is a different side from the existing starting margin, so the component can acquire spacing on both sides.

Better

html
<blockquote class="ms-4 border-s-2 ps-4 md:ms-10">  <p>راجع انتقال الممثلين قبل بدء المشهد الختامي.</p></blockquote>

The larger indentation now belongs to the same logical side as the base indentation. Under LTR, the replacement still maps to the left. Tailwind's margin reference describes ms-* and me-* as inline-start and inline-end margins.

Check immediately below and above the project's actual breakpoint. Inspect both physical margins, not just the logical value. Then repeat in English to confirm the larger indentation has not changed sides or disappeared.

Apply the same diagnosis to pr-*, pl-*, negative margins and state variants. A component can contain logical base padding but reintroduce a physical edge through focus:pr-* or a shared compact-size class. Search the complete class list and the component's defaults.

Remove obsolete resets when replacing physical classes. Retaining ml-0 alongside a new starting margin can create a cascade conflict in one direction while affecting another side in the other direction. Moving the strings around in the HTML attribute does not establish CSS precedence.

R030 covers direction-sensitive physical properties without an RTL override. Use the finding to inspect the intended relationship. A stage-plan annotation measured from an image's physical left edge is a different case and should remain attached to that coordinate.

Arabic text stays left-aligned inside a correctly directed panel#

If the panel's computed direction is RTL but a rehearsal note still aligns left, inspect text-left on the text element or one of its ancestors. Changing the panel's direction again will not cancel an explicit alignment declaration.

For text that should follow its own reading start, replace the physical alignment:

html
<!-- Problem --><p class="text-left">تبدأ مراجعة الإضاءة بعد انتهاء التدريب الحركي.</p> <!-- Better --><p class="text-start">تبدأ مراجعة الإضاءة بعد انتهاء التدريب الحركي.</p>

text-start remains left alignment in horizontal LTR and becomes right alignment in horizontal RTL. The Tailwind alignment reference distinguishes these utilities. text-right would force a physical edge in both language versions instead of stating that relationship.

Inspect an element that actually has width available for alignment. A short inline-sized label may look unchanged because there is no spare space inside its box. Its placement within a parent is a separate flex, grid or positioning decision.

Do not force every technical value to follow the surrounding Arabic alignment and direction. An English production note or an email address can require its own local boundary. Keep the exception on the value or content region, rather than setting a whole Arabic report to LTR.

R022 covers explicit left alignment on majority-Arabic text. If the actual problem is punctuation or an identifier's displayed order, use bidi isolation instead of treating text alignment as a bidi repair.

A popover changes sides but stretches across its parent#

A direction override can add a second inset without removing the first. This reproduction intends to anchor a content-sized action panel at the rehearsal card's starting edge:

Problem

html
<div class="relative w-80">  <button type="button">خيارات التدريب</button>  <div class="absolute left-0 top-full rounded-md border p-4 rtl:right-0">    <button type="button">تعديل وقت التدريب</button>  </div></div>

In RTL, the panel has both left: 0 and right: 0. With its automatic width and no narrower constraint, it spans the space between those edges. This is a positioning constraint, not a translated-label width problem. MDN documents how paired left and right insets interact with width.

Better

html
<div class="relative w-80">  <button type="button">خيارات التدريب</button>  <div class="absolute inset-s-0 top-full rounded-md border p-4">    <button type="button">تعديل وقت التدريب</button>  </div></div>

One logical starting inset expresses the intended anchor. The English panel remains anchored left; the Arabic panel anchors right. The inset utilities map that instruction to CSS. The current v4 spelling is inset-s-*; v3.3/v3.4 use start-* for this property.

If physical insets are required, explicitly reset the old side, for example with rtl:left-auto alongside rtl:right-0. Do not replace a trailing English right-* anchor with inline start: a trailing relationship would need inline end to preserve the English layout.

Inspect the containing block as well. A logical anchor can be correct relative to the wrong ancestor. A popover library may also supply inline positioning styles, so review its placement configuration before adding a competing inset.

Separate those ownership problems in the reproduction. Inspect the trigger's box, the positioned panel's box and the ancestor used as its containing block. If the trigger is correct but the panel is offset, changing the trigger's margin can disguise the error at one width while moving both elements somewhere else. Repair the panel's placement rule instead.

Check the final rendered styles after the positioning library has run. A class can be present while an inline inset, a translation or a size constraint determines the result. Compare the library's configured placement in English and Arabic, then test after scrolling and resizing. A panel positioned only once can look right when first opened and lose its relationship after the available geometry changes.

Test the open panel near both viewport edges and with its longest action label. The fixed parent width here isolates the reproduction; it is not a responsive layout recommendation. For containing-block and overflow cases beyond this symptom, use absolute positioning in RTL layouts.

A centered label shifts because its translation stayed physical#

Logical insets and horizontal translation use different coordinate rules. The planner centers a room-status label beneath a rehearsal heading:

Problem

html
<div class="relative w-72 py-4">  <h2>تدريب المشهد الختامي</h2>  <span id="rehearsal-tooltip"        class="absolute inset-s-1/2 top-full w-max -translate-x-1/2 border p-2">    غرفة التدريب محجوزة  </span></div>

Under LTR, the starting inset places the label's left edge at the parent's midpoint, then the negative translation moves it back by half its own width. In RTL, the starting inset references the other side, but the negative x-translation still moves left. Changing the anchor did not make translation logical.

Keep the LTR translation and provide the opposite offset for this RTL centering relationship:

html
<div class="relative w-72 py-4">  <h2>تدريب المشهد الختامي</h2>  <span id="rehearsal-tooltip"        class="absolute inset-s-1/2 top-full w-max -translate-x-1/2 border p-2 rtl:translate-x-1/2">    غرفة التدريب محجوزة  </span></div>

The inset percentage refers to the containing block, while the translation percentage uses the translated element's reference box. MDN's translateX reference explains the translation percentage; Tailwind documents the corresponding utilities.

Compare the label's center with the parent's center in both modes. Then use a longer translated status so the test cannot pass merely because the label is narrow. Check near the viewport edge separately, since correct centering does not provide collision handling.

For this reproduction, measure the difference directly after any opening animation has settled:

js
const label = document.querySelector('#rehearsal-tooltip');if (!label || !label.parentElement) throw new Error('Open the label fixture first.');const labelBox = label.getBoundingClientRect();const parentBox = label.parentElement.getBoundingClientRect();console.log({  horizontalCenterDifference: Math.abs(    (labelBox.left + labelBox.right) / 2 -    (parentBox.left + parentBox.right) / 2  ),});

getBoundingClientRect() supplies the rendered boxes used in this comparison. In an automated version, choose and document a small tolerance for fractional layout values rather than requiring a particular rounded pixel string. Run the comparison in LTR and RTL, then change the label's text and repeat. The intended invariant is a shared horizontal center, not one hard-coded left offset.

Do not flip every movement after finding this bug. A physical drag offset on a stage diagram should follow the pointer's coordinate system. A sequence transition may need to follow reading direction. The intended interaction determines whether the sign changes.

R033 covers translateX moving an element off-screen in RTL. Current Tailwind output also needs direct browser inspection because it can use the individual CSS translate property rather than a translateX() function.

Inspect translate as well as transform after a v4 upgrade#

An inspector or reset that checks only transform can miss the active translation. Tailwind v4 bases translation utilities on the individual property; its upgrade guide also explains why transform-none no longer resets those individual transform utilities.

Run this on either label reproduction:

js
const element = document.querySelector('#rehearsal-tooltip');if (!element) throw new Error('Open the rehearsal label fixture first.');const style = getComputedStyle(element);console.table({  direction: style.direction,  left: style.left,  right: style.right,  translate: style.translate,  transform: style.transform,});

The individual translate property is separate from transform. Inspect both, including any custom CSS that sets another transform. Two offsets can be active together.

For a responsive reset, choose the reset that matches the generated property. A custom transition list that names only transform also needs review after migration. Verify the animation between states, not only its final screenshot.

Hiding overflow conceals the misplaced panel#

Adding overflow-x-hidden to the page can make a sideways scrollbar disappear while leaving the rehearsal panel outside the visible area. That changes what can be seen or scrolled; it does not correct the anchor or translation that placed the panel there.

Temporarily remove the clipping rule in the reproduction and open the failing component. Inspect its rendered box and the viewport edges. Disable the suspect translation and inset declarations one at a time, keeping the same viewport and panel content. This distinguishes a panel that was misplaced from a panel whose contents are simply wider than the available space.

Tailwind's overflow utilities control clipping and scrolling. Apply them to the region whose content policy requires them. A deliberately scrollable rehearsal log is different from an action panel that must remain visible and reachable. Do not replace the former's scrolling with page-level hiding as part of the latter's repair.

R040 covers document-level horizontal overflow. A passing width check after adding clipping does not establish that every action remains available. Reopen the panel, reach each control with the keyboard and test the same interaction near both viewport edges.

Keep collision handling separate from reading-direction placement. An inline-start anchor can be correct and still leave a wide panel outside a narrow viewport. In that case, review available width, wrapping and the overlay library's collision settings. A fixed opposite-side override may only transfer the failure to the other edge. Use fixing horizontal overflow in RTL when the document itself still exceeds its width after the placement is corrected.

RTL variants leak into a locally LTR production note#

The planner can contain an English note supplied by a visiting company. A local dir="ltr" does not necessarily prevent every ancestor-based rtl: selector from matching its descendants.

Consider this alignment choice:

html
<section dir="ltr" lang="en" class="ltr:text-left rtl:text-right">  Visiting company production notes</section>

Inside an RTL document, the current built-in variants can both match: one through the local LTR direction, another through an RTL ancestor. The winning result then depends on the cascade, not the order of the classes in the attribute.

The Tailwind variant reference includes an ancestor branch such as [dir="rtl"] *. Inspect the selector emitted by your installed version rather than assuming it always represents the nearest direction boundary.

For this text alignment, use text-start on the locally LTR section and remove the competing variants. That directly expresses alignment to the note's own starting edge. For behavior without a logical property, an arbitrary selector such as [&:dir(rtl)]:translate-x-1/2 can target the element's own HTML directionality.

MDN's dir pseudo-class reference explains inherited semantic direction and its difference from CSS-only direction. Test a locally Arabic region, a locally English region and the ordinary document-inherited case before adopting a selector change across shared components.

Portals need a separate ancestry check. A panel rendered under body cannot inherit from a local wrapper that is not its ancestor. Inspect the actual rendered tree and the library's direction settings instead of adding another override to the trigger.

A floated callout moves incorrectly or the following note wraps beside it#

Some rehearsal reports use text wrapping around a short stage-requirements callout. Migrating only the float leaves its gap and clearing rule attached to English physical sides.

Problem

html
<section class="flow-root">  <aside class="float-left mb-3 mr-5 w-40 border p-3">متطلبات الخشبة</aside>  <p>يحتاج المشهد إلى مساحة خالية لحركة مجموعة الممثلين.</p>  <p class="clear-left">تراجع خطة الإخلاء بعد تثبيت مواقع المعدات.</p></section>

Better

html
<section class="flow-root">  <aside class="float-start mb-3 me-5 w-40 border p-3">متطلبات الخشبة</aside>  <p>يحتاج المشهد إلى مساحة خالية لحركة مجموعة الممثلين.</p>  <p class="clear-start">تراجع خطة الإخلاء بعد تثبيت مواقع المعدات.</p></section>

The starting float, ending gap and starting-side clearance form one relationship. Under horizontal LTR they retain the original physical sides. Under RTL they adapt together. Tailwind documents the float and clear utilities; MDN explains the float values.

The flow-root wrapper creates a formatting context for the floated content, as described in the CSS display reference. It serves containment, not direction.

Check the callout, its text gap and the point where the following paragraph resumes below it. Test the narrowest width that supports this treatment. If the callout leaves too little room for readable text, choose a stacked layout there rather than adding increasingly narrow widths.

R031 covers left/right floats on content elements in RTL context without an override. If the product needs a fixed sidebar rather than text flowing around content, reconsider the layout mechanism separately. A float-side repair does not turn the component into a grid.

An old space-x reversal becomes a new upgrade bug#

When spacing changes after an upgrade, inspect the generated child margins before changing document direction. A class list such as space-x-4 rtl:space-x-reverse has version-dependent implications.

The v3 space utilities use physical horizontal child margins. A normal RTL row can need reversal to put that gap on the intended side. Current v4 spacing uses logical margins and a different child selector, documented in the current margin reference and the upgrade guide.

For a normal v4 row, carrying the old RTL reversal forward can switch the child margins unnecessarily. Remove it only after confirming the row's actual flow. A row that intentionally uses flex-row-reverse is a different case and may still need the spacing reversal that corresponds to that order.

Inspect which child receives the margin. Include the first and last rehearsal action, hidden actions and any additional per-child margins. The selector's behavior matters as much as the numeric gap.

For a group that wraps or uses a grid, consider gap-4 instead of a child-margin shortcut. Remove the old spacing utility when making that change, or both sources of separation can apply. Review each wrapped line at a narrow width instead of approving only the single-row desktop state.

Do not classify the entire issue as an Arabic translation failure if the same upgrade also changes English spacing. Capture both modes. That distinguishes an RTL-only workaround from a shared spacing implementation change.

The toolbar looks English again after row-reverse is added#

A normal flex row starts at the inline-start edge. In an RTL toolbar, that puts its first source item on the right. Adding rtl:flex-row-reverse reverses it again.

Inspect flex-direction before reversing the button array or changing margins. If the intended rehearsal actions already appear in source reading order, remove the RTL row reversal and retain ordinary row flow. MDN describes this interaction between flex direction and dir.

Then Tab through the toolbar and activate each action. A visually rearranged row can still expose a sequence the user did not expect. Check any order-* utilities and avoid compensating with positive tabindex values.

R081 covers row-reverse used to fake RTL instead of declaring direction. Reversal remains valid when the interface deliberately needs the opposite sequence within the current direction; document that intent and test it rather than applying a blanket ban.

The replacement class exists in source but never reaches the page#

Before adding more specificity, find the replacement utility in the loaded stylesheet. If it is absent, the issue is class generation or stylesheet delivery. If it exists but is crossed out, the issue is the cascade or a competing component style.

Check the installed version and complete class spelling. Then inspect source registration, especially for a rehearsal component imported from a shared package. Development may appear to work because another screen happens to request the same utility.

Keep full class names as literals. Constructing a utility from a direction-selected fragment does not guarantee Tailwind discovers the resulting names. Its source-detection guide explains the scanning boundary and explicit source registration.

Build with the production pipeline and inspect its actual CSS. Do not use a safelist entry to hide an incorrect source boundary without deciding whether that is the intended build policy. Also inspect inline styles and arbitrary property utilities: [margin-left:22px] remains a physical declaration even though it is written inside a Tailwind class attribute.

Retest the failing state and its English counterpart#

For every repair, repeat the exact viewport and interaction that exposed the bug. An open popover, a long status label and an active medium breakpoint are different test inputs, even when they belong to the same rehearsal card.

Compare English before and after the change. A logical replacement should preserve its intended relationship there. If the repair deliberately changes a shared width or wrapping policy, review that change in both languages rather than describing it as a side-only substitution.

Check computed direction, both physical edges and any active translation. Keep screenshot evidence alongside the matched declarations. A correct class name does not establish that an overlay remains visible or that keyboard focus follows the intended controls.

When reporting a defect, include the full relevant class list, Tailwind version, active breakpoint and whether the component lives in a local direction wrapper or portal. That turns “RTL spacing is broken” into a reproduction another engineer can run.

A free Ritla scan can surface direction-sensitive physical properties without RTL overrides or explicit left alignment on majority-Arabic text after the repair; use the original reproduction to verify the component's behavior. Continue with debugging RTL layout problems when the generated rules still disagree with the intended layout, or testing across breakpoints when the failure appears only in a responsive state.

Checks in this guide

See what your Arabic pages are hiding

Paste a URL. Ritla renders the page on desktop and mobile, runs every check, and shows the top issues with screenshot evidence.

Scan a page freeBrowse the checks