3.2 KiB
RTL Progress Bar Fix Documentation
Problem
When switching the application language to Arabic (RTL mode), all progress bars were disappearing from the interface.
Root Cause
The issue was caused by the RTL CSS file (app-rtl.min.css) which applies right-to-left layout transformations. Progress bars in Bootstrap are designed to fill from left to right, and the RTL transformations were causing them to become invisible or not render properly.
Solution
Created a custom CSS override file (static/css/rtl-fixes.css) that is loaded specifically when Arabic language is selected. This file contains targeted fixes for progress bars in RTL mode.
Implementation Details
Files Modified/Created:
-
static/css/rtl-fixes.css(NEW)- Contains CSS rules to fix progress bar rendering in RTL mode
- Forces progress bars to maintain LTR direction
- Ensures visibility and proper styling
-
templates/base.html(MODIFIED)- Added conditional loading of
rtl-fixes.csswhenLANGUAGE_CODE == 'ar' - The fix file is loaded after
app-rtl.min.cssto override problematic styles
- Added conditional loading of
Key CSS Fixes Applied:
/* Force progress container to use LTR direction */
.progress {
direction: ltr !important;
}
/* Ensure progress bar fills from left to right */
.progress-bar {
transform-origin: left center !important;
}
/* Ensure all progress bar color variants are visible */
.progress-bar.bg-success,
.progress-bar.bg-info,
.progress-bar.bg-warning,
.progress-bar.bg-danger,
.progress-bar.bg-primary,
.progress-bar.bg-secondary {
opacity: 1 !important;
visibility: visible !important;
}
How It Works
- When a user selects Arabic language, the
base.htmltemplate detectsLANGUAGE_CODE == 'ar' - The template loads:
app-rtl.min.css(main RTL styles)rtl-fixes.css(progress bar fixes) ← NEW
- The
rtl-fixes.cssoverrides specific RTL styles that were breaking progress bars - Progress bars now render correctly while the rest of the page remains in RTL layout
Testing
To test the fix:
- Switch language to Arabic in the application
- Navigate to any page with progress bars (e.g., Leave Requests page)
- Verify that:
- Progress bars are visible
- Progress bars show the correct percentage
- Color coding (success/warning/danger) works correctly
- Animations work smoothly
Affected Pages
This fix applies globally to all pages that use Bootstrap progress bars, including:
- Employee Leave Requests
- HR Dashboard
- Any custom pages with progress indicators
Maintenance Notes
- The
rtl-fixes.cssfile should be kept in sync if the main CSS framework is updated - If new progress bar issues appear in RTL mode, add additional rules to
rtl-fixes.css - The file is intentionally kept separate from
app-rtl.min.cssfor easier maintenance
Alternative Approaches Considered
- Modifying
app-rtl.min.cssdirectly: Not feasible due to file being minified and very large - JavaScript-based fix: Would add unnecessary complexity and performance overhead
- Individual template fixes: Would require changes to multiple files and be harder to maintain
The chosen CSS override approach is the cleanest and most maintainable solution.