Common Bootstrap RTL problems
Diagnose Bootstrap RTL failures in stylesheets, custom CSS, dropdowns, carousels and icons, then verify fixes across languages and screen sizes.
By Omran Khleifat, Founder of Ritla
Guide14 min read
An Arabic Bootstrap photo-review page can have correctly aligned captions while its Next button opens the wrong inspection view. A dropdown can work after a direct Arabic load but open against the wrong edge after a language switch. Those symptoms need different investigations, even if both disappear when someone adds another RTL override.
Bootstrap's RTL stylesheet covers the framework rules in that build. Application CSS, component initialization and external icons have their own behavior. Troubleshooting starts by identifying which of those boundaries failed, not by adding another global reversal.
This guide uses a harbor-maintenance portal that reviews inspection photographs. The examples target Bootstrap 5.3, with source-level details checked against 5.3.8. They isolate stylesheet, sequence, placement and icon failures so that a repair can preserve the working English interface too.
Match the symptom to the layer that can cause it#
Keep one failing inspection record open and record the viewport, language and interaction. Reproduce the failure before changing CSS. A closed dropdown and a completed carousel transition are different states from an open menu and a moving slide.
| Symptom | First evidence to inspect |
|---|---|
| Standard components and utilities disagree about sides | Loaded CSS builds, versions and document direction |
| One custom review badge stays at the English edge | Winning application rule and its source |
| A control does nothing in either language | JavaScript loading, markup version and target identifiers |
| Carousel labels disagree with the displayed record | Slide order, action wiring and completed-transition event |
| Menu alignment changes after switching language | Root direction, loaded module and placement configuration |
| A directional arrow disagrees with the action | Icon source, inherited transforms and mirroring rules |
| The page scrolls sideways only with a long filename | Overflowing element, flex sizing and wrapping |
Temporarily remove the portal theme and application overrides from a small reproduction while retaining the same framework version. If the Bootstrap component works there, restore the extra styles or wrappers until the failure returns. Do not upgrade the framework and change the markup during that reproduction; doing both introduces another explanation for the result.
For each element, inspect computed direction and the winning declaration separately. A right-aligned caption proves neither that the root is RTL nor that the correct Bootstrap build is active. Use debugging RTL layout problems when you need a broader method for tracing the cascade.
The Arabic document has the wrong or duplicate stylesheet#
The Arabic document needs its own direction declaration and Bootstrap's RTL CSS. Check the root markup:
<html lang="ar" dir="rtl">Then inspect the stylesheet actually delivered. In Bootstrap 5.3, the distributed RTL file is bootstrap.rtl.css or its minified equivalent. The ordinary bootstrap.css is not a neutral base that should also remain active globally. Follow the Bootstrap RTL setup for the release being deployed.
Duplicate builds create a misleading cascade. One utility can set a left margin while the other sets a right margin, leaving both active because they are different properties. Moving the RTL link later cannot unset every declaration supplied by the other build.
Inspect both physical sides on an affected element. Trace each winning margin or padding to its asset, then search the application imports, theme imports and route entry points for the unintended build. A bundled stylesheet may not retain Bootstrap's filename, so checking link elements alone is insufficient.
Retest a direct Arabic load, an English-to-Arabic navigation and a refresh of the review page. A route that appends another stylesheet can make the result depend on navigation history. Confirm that the CSS response is the current deployed asset rather than an older cached build.
Keep CSS and JavaScript on a matching release. A theme compiled against another Bootstrap major can contain incompatible selectors even when its filename includes RTL. Check its declared compatibility and emitted rules before patching individual components.
The W3C document-direction guidance explains why HTML direction remains necessary alongside the stylesheet. covers document direction missing, contradicted, or declared only in CSS. A scan result about that declaration does not establish whether a carousel action selects the intended record.
Start and end utilities fail inside a different-direction region#
Bootstrap's class names describe logical intent, but that does not make every compiled declaration a native logical property. A nested LTR inspector note inside an RTL document can expose this distinction.
For example, the RTL build's ms-* spacing remains the side selected by that build when a child changes dir. Inspect its emitted margin rather than expecting the attribute to select the ordinary stylesheet locally. The spacing reference documents the classes; the distributed RTL CSS is the declaration-level evidence.
For a small custom note, remove conflicting framework alignment or spacing utilities and give its component class native logical properties. For a complete embedded Bootstrap interface in the other direction, review a scoped dual-build integration instead. Loading two unscoped builds recreates the previous failure.
An application override can also lose to a utility's !important. Inspect importance before adding a longer selector. Bootstrap's utility API describes utility generation, including important declarations. Transfer ownership deliberately: remove the incompatible class when a component rule should control that property.
Check responsive variants while resizing. A base rule can work until a breakpoint-specific margin or alignment rule becomes active. Record the active media query with the computed result. A repair tested only at a narrow width can leave the wider review toolbar unchanged.
Keep hover, focus and expanded-state rules in that inspection. A theme may use logical spacing in its default button rule but restore a physical margin in an active-state selector. Disable the winning state rule temporarily and compare again. Repairing the default selector while leaving the active override untouched produces a control that appears fixed until someone operates it. Include that interaction in the reproduction so the next reviewer does not validate only the resting state.
A custom badge stays on the English side#
The portal places a review-stage badge over each inspection photograph at the interface's reading end. Its application stylesheet was written separately from Bootstrap and contains this rule:
/* Problem: ordinary application CSS, outside the RTL build. */.inspection-frame { position: relative; }.review-stage { position: absolute; top: 18px; right: 18px;}Here, .inspection-frame is the photograph's positioned wrapper and .review-stage is its status badge. Loading Bootstrap RTL does not rewrite that separate file. The physical right coordinate stays right.
If the badge belongs at reading end, replace the rule with:
.inspection-frame { position: relative; }.review-stage { position: absolute; top: 18px; inset-inline-end: 18px;}The English badge retains its right inset; horizontal RTL maps the same relationship to the left. The CSS logical-properties specification defines that mapping. Remove the original right declaration instead of keeping both coordinates and allowing the cascade to determine the geometry.
covers direction-sensitive physical properties without an RTL override. Inspect inline styles and third-party review widgets as well as stylesheets. Bootstrap cannot transform a physical coordinate that never entered its RTL generation process.
Keep an intentional image coordinate physical. A marker identifying corrosion on a photographed ladder must stay attached to that feature in both languages. The review-stage badge is interface chrome; the corrosion marker represents image content. Applying the same mirroring rule to both loses that distinction.
Test the repaired badge on the same photograph in both languages, including the longest translated status. Check whether it obscures an important feature or escapes the frame on a narrow screen. Correct direction does not establish that an absolute overlay has enough room.
A dropdown does nothing, or closes immediately#
First test the same control in English. If it fails there too, investigate its basic integration before making an RTL change. Confirm that the matching JavaScript loads, required positioning dependencies are available and target identifiers refer to existing elements.
Bootstrap 5 namespaces plugin attributes with data-bs-. A template using data-toggle with Bootstrap 5 JavaScript does not become functional through an RTL stylesheet. The migration guide documents that change.
Check that the page does not load a CDN bundle alongside another bundled Bootstrap copy. Also inspect custom click handlers that toggle the same state or re-render the trigger during opening. Remove one competing owner at a time and reproduce the original click. Do not assume that adding another constructor call will repair conflicting initialization.
Use the component's documented lifecycle events to determine whether it opened and was then hidden, or never opened at all. Bootstrap's JavaScript guide explains its methods and events. That difference is more useful than a screenshot of a closed menu.
Once the control operates, test its RTL placement separately. A working click handler says nothing about the side on which the menu appears.
A dropdown aligns to the wrong edge#
Decide the intended relationship first. dropdown-menu-end aligns to the corresponding end in the selected Bootstrap build; it does not promise the physical right edge in every language. An RTL menu appearing on the left can therefore be the expected result.
For breakpoint-dependent alignment, configure the documented static-display path. This probe aligns at start below the large breakpoint and at end above it:
<div class="dropdown"> <button type="button" class="btn btn-outline-secondary dropdown-toggle" id="harbor-actions" data-bs-toggle="dropdown" data-bs-display="static" aria-expanded="false"> إجراءات صورة الفحص </button> <ul class="dropdown-menu dropdown-menu-lg-end" aria-labelledby="harbor-actions"> <li><button type="button" class="dropdown-item">طلب لقطة أقرب للتآكل</button></li> <li><button type="button" class="dropdown-item">إحالة إلى مهندس الصيانة</button></li> </ul></div>Load the matching Bootstrap CSS and bundle, then connect the item buttons to the portal's existing actions. The dropdown documentation specifies static display for responsive alignment outside navbars. Without the matching configuration, breakpoint classes alone do not describe the full positioning behavior.
Dynamic placement is a different choice. If the portal needs Popper to react to viewport constraints, inspect the resulting placement and boundary configuration. Do not overwrite its transform with a fixed physical offset while expecting its positioning logic to remain authoritative.
Reproduce the menu near both viewport edges and inside the scrolling review panel. Inspect clipping ancestors as well as alignment. A menu cut off by an overflow boundary is not repaired by increasing z-index; clipping and stacking are different constraints. Removing overflow globally can break the panel's intended scrolling, so change the responsible boundary or component placement deliberately.
Test keyboard opening, item navigation, Escape and focus after dismissal. These need interaction checks even when a scan or screenshot shows a correctly aligned menu.
A locally RTL preview disagrees with Bootstrap JavaScript#
Putting dir="rtl" on the photo-review wrapper can make its text read correctly while leaving the document root LTR. This is a real boundary in Bootstrap 5.3.8: the framework's direction helper reads document.documentElement.dir.
Compare the wrapper's computed direction with the root attribute. If they disagree, a JavaScript component using that helper is not necessarily following the wrapper's local direction. Neither an Arabic lang value nor a CSS direction declaration changes that helper's input.
For a full Arabic document, resolve the locale and set root direction before loading the framework. For a truly mixed-direction application, review the behavior of each embedded component rather than promising that a local wrapper controls the entire framework. A separate document can provide an independent root when the product requires that isolation, but it brings its own embedding and interaction work.
Language switching adds another complication. In the 5.3.8 dropdown source, direction-dependent placement constants are calculated when the module is evaluated. Changing the root attribute later does not recompute those constants. Recreating a dropdown instance alone does not reevaluate its module either.
Compare a fresh Arabic load with an English load followed by a switch. If only the second path fails, investigate initialization timing and module-level configuration. For this version, full document navigation with the correct initial direction is one way to obtain matching initialization. A client-side solution needs an explicit, tested placement strategy; adding another dir attribute is incomplete.
Check tooltips too. Their 5.3.8 attachment map also resolves left and right through the root-direction helper at module evaluation. Treat that as a version-specific implementation detail to recheck during upgrades.
A tooltip is missing or retains its English text#
Tooltips require explicit initialization, unlike a dropdown's ordinary data-attribute path. If the photo-quality hint never appears, confirm initialization, a nonempty title and the positioning dependency before investigating RTL placement. The tooltip documentation covers those requirements and the content-update API.
This probe deliberately starts with an untranslated hint:
<button id="photo-quality-help" type="button" class="btn btn-outline-secondary" data-bs-toggle="tooltip" data-bs-title="Show the entire impact fender"> معيار قبول الصورة</button>After the markup and matching bootstrap.bundle.min.js have loaded, initialize it once:
// bootstrap is the namespace supplied by the matching browser bundle.const photoHelpTrigger = document.getElementById('photo-quality-help');const photoHelp = new bootstrap.Tooltip(photoHelpTrigger);If the application changes language after initialization, changing template text alone does not establish what the existing instance displays. Update the live content as well:
// Run when the application applies this reviewed Arabic translation.photoHelpTrigger.setAttribute('data-bs-title', 'أظهر حاجز الارتطام كاملاً في الصورة');photoHelp.setContent({ '.tooltip-inner': photoHelpTrigger.getAttribute('data-bs-title') });For a direct Arabic load, render the translated hint before initialization instead. Keep this content repair separate from the module-level placement issue described above. Updating a sentence does not recalculate the framework's direction constants.
Focus the trigger with the keyboard, inspect the displayed hint, move focus away, then reopen it after switching language. Repeat near the review panel's edge. Check the tooltip's rendered DOM location when diagnosing direction inheritance; its trigger's wrapper is not evidence of the tooltip's own ancestry.
Carousel next and previous disagree with the review sequence#
Separate the record sequence from physical animation direction. Next should select the next inspection view in the product's sequence. A motion toward a particular screen edge is not a reliable substitute for that contract.
Remove custom transforms and reverse-order classes, then test Bootstrap's own sequence with text panels. This probe avoids loading photographs so that the active item is unambiguous:
<div id="harbor-review" class="carousel slide" data-bs-interval="false" data-bs-wrap="false" tabindex="0" role="region" aria-label="مراجعة لقطات فحص الرصيف"> <div class="carousel-inner"> <div class="carousel-item active"> <p class="border rounded p-4 mb-0">واجهة الرصيف</p> </div> <div class="carousel-item"> <p class="border rounded p-4 mb-0">حاجز الارتطام</p> </div> <div class="carousel-item"> <p class="border rounded p-4 mb-0">قاعدة السلم البحري</p> </div> </div></div><div class="d-flex gap-2 mt-3"> <button type="button" class="btn btn-outline-primary" data-bs-target="#harbor-review" data-bs-slide="prev">اللقطة السابقة</button> <button type="button" class="btn btn-outline-primary" data-bs-target="#harbor-review" data-bs-slide="next">اللقطة التالية</button></div>Use the matching Bootstrap bundle and the selected direction's CSS. The probe does not autoplay and does not wrap at the end. It deliberately keeps the source order unchanged across languages.
Check the first-to-second and second-to-third transitions, then go back. Compare the active item's identity, not just which way it moved. In Bootstrap 5.3.8, the carousel implementation already accounts for RTL when converting between movement direction and next/previous order. A custom reversal on top of that can introduce another correction.
If the selected record is wrong, inspect application wiring. A second click handler may call prev() while the data attribute requests Next. Remove the competing handler rather than rewriting the framework's transition CSS. Restore the real photographs only after the sequence probe works.
For application state synchronized to the displayed item, use the completed transition and its item index:
const review = document.getElementById('harbor-review');review.addEventListener('slid.bs.carousel', (event) => { console.log({ displayedIndex: event.to, element: event.relatedTarget });});Run this after the probe markup exists. The carousel event reference distinguishes transition start from completion and documents to, from and relatedTarget. Do not derive the selected inspection record from the event's physical direction string.
Wait for completion between ordinary sequence assertions. Bootstrap documents that calls made during a transition can be ignored. A test that issues several Next commands immediately and counts each call as a displayed record can report a sequence failure unrelated to RTL. Test rapid repeated activation as a separate interaction: verify the settled record and its caption after the component finishes, using the product's intended handling of repeated input.
If the active panel is correct but fetched inspection details describe another photograph, inspect the application's request handling. A delayed response for the previous record can overwrite details after navigation has moved on. Associate the response with the requested record and ignore or cancel stale work before updating the current view. Reproduce this with delayed responses in both languages. Correcting the request boundary addresses the mismatched details; reversing the carousel would only change which interaction exposes them.
Focus the review region and repeat with arrow keys, then test touch gestures on supported devices. Check the first and last items with wrapping disabled, and test reduced-motion settings. If only the animation is wrong, inspect custom transition rules; if the active index is wrong, inspect sequence logic and handlers. Keep those diagnoses separate.
An arrow is mirrored twice, or never mirrored#
Bootstrap's built-in control styling does not establish a direction policy for every external icon set. Inspect whether the rendered icon comes from framework CSS, an SVG, an icon font or application markup. Then inspect transforms on the icon and its ancestors.
Suppose the portal replaces the probe's Next button with a custom arrow. This version supplies an LTR arrow directly, so the RTL stylesheet cannot rewrite the glyph itself:
<button type="button" class="btn btn-outline-primary" data-bs-target="#harbor-review" data-bs-slide="next"> <span class="review-next-icon d-inline-block" aria-hidden="true">→</span> اللقطة التالية</button>For this sequence control, preserve the English arrow and mirror only its icon in the Arabic document:
html[dir="rtl"] .review-next-icon { transform: scaleX(-1);}Keep this application rule outside a transformation step that would reinterpret the exception. MDN's transform reference documents the transform. Test the arrow against the Next action in the earlier probe; its label and destination remain the same action.
If the icon package already supplies an RTL variant, remove this extra mirroring rule instead. Check the normal, hover and focus states: an animation that also writes transform can replace the mirror. Give separate elements responsibility for orientation and motion when both are needed.
covers a directional icon pointing against the sequence its control advances. It does not mean that every image should flip. Preserve the orientation of harbor photographs, compass bearings, logos and physical defect markers. See what should be mirrored in RTL for that distinction.
A narrow review panel overflows despite correct direction#
Inspect the element that exceeds the available width before changing RTL configuration. A long source filename can expose a flex-sizing constraint even when Bootstrap's columns and margins are correct.
For a custom flex child containing the inspection details, this application CSS allows the child to shrink and gives its filename a wrapping opportunity:
.review-details { min-width: 0; }.inspection-filename { overflow-wrap: anywhere; }Here .review-details is the shrinking child of the portal's flex toolbar, and .inspection-filename is the filename text inside it. Remove any conflicting fixed width or no-wrap utility when it should no longer own that behavior. MDN's minimum-width reference explains automatic minimum sizes; its overflow-wrap reference explains the wrapping choice.
Also inspect Bootstrap row gutters. Their negative row margins and column padding need the expected wrapper relationship. An enlarged gutter without suitable surrounding space can exceed the panel; consult the gutter documentation.
Do not add overflow-x: hidden to the document as the first repair. It can hide the symptom while making menu items or image controls unreachable. Bootstrap's overflow utilities change overflow behavior; they do not establish why the content exceeded its box.
covers document-level horizontal overflow. Check internal scrolling panels separately, including the open menu state and the longest real filename. Continue with fixing horizontal overflow in RTL when the remaining issue is the overflow boundary rather than the framework build.
Verify the repair in the states that originally failed#
Remove temporary compensating rules after the source repair. Leaving a manual arrow reversal or old physical margin active can recreate the defect once the correct stylesheet or module initialization is restored.
Replay the same harbor record through a direct Arabic load, an English load, a language switch and browser back navigation. Open the action menu, move through the review sequence and return to its first item. Repeat at the panel's narrowest supported width with long translated text and filenames.
Record the winning rule or initialization decision that changed, plus the expected LTR and RTL outcomes. A passing screenshot of the first slide cannot verify the selected record after Next, and an event index cannot verify that an arrow points in the intended direction. Keep visual checks and interaction assertions for their respective outcomes.
A free Ritla scan of the Arabic review page can surface custom direction-sensitive physical properties without RTL overrides and directional icons pointing against their control's sequence. Use what should be mirrored in RTL to resolve remaining icon decisions, or fixing horizontal overflow in RTL when an open menu or review panel still extends beyond the document.