<p></p>
<p dir="auto">As part of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1108341337" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3427" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/3427/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/3427">#3427</a> and following up from the last part of <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1108345241" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3428" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/3428/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/3428">#3428</a> we have a problem where all text, even with dir=auto, is forced into a pre-determined alignment. This is because we set the global text-alignment explicitly in our CSS:</p>
<p dir="auto"><a href="https://github.com/openstreetmap/openstreetmap-website/blob/3a534ea895fd60d2c5cccc66251e5472868c0f4e/app/assets/stylesheets/common.scss#L29-L31">https://github.com/openstreetmap/openstreetmap-website/blob/3a534ea895fd60d2c5cccc66251e5472868c0f4e/app/assets/stylesheets/common.scss#L29-L31</a></p>
<p dir="auto">This property then cascades down to every element. Setting dir="auto" on a child element is not enough to override this global text-align. But if we omit the text alignment altogether, everything works fine by default. Having dir=rtl on the body makes everything right-aligned by default, and where we specify dir="auto", then the alignment will automatically flip based on content (since there is no overriding text-align set).</p>
<p dir="auto">Unfortunately bootstrap 4 has <a href="https://github.com/twbs/bootstrap/blob/349a373ff62bf530135ad95d7d1d3f1be6abbf22/scss/_reboot.scss#L53"><code>text-align: left</code> hardcoded</a> and expects RTL-only sites to override this. But in bootstrap 5, which has additional focus on RTL, that was <a href="https://github.com/twbs/bootstrap/pull/28989" data-hovercard-type="pull_request" data-hovercard-url="/twbs/bootstrap/pull/28989/hovercard">removed</a>, and the <a href="https://github.com/twbs/bootstrap/blob/520cc8de92ca48d7ac60102d992d7afe9788b239/scss/_variables.scss#L401">default <code>text-align</code> is now null</a> allowing dir="auto" to work as intended.</p>
<p dir="auto">So fixing this is split into three parts:</p>
<ul dir="auto">
<li>Upgrade to bootstrap 5 (<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="927086260" data-permission-text="Title is private" data-url="https://github.com/openstreetmap/openstreetmap-website/issues/3230" data-hovercard-type="issue" data-hovercard-url="/openstreetmap/openstreetmap-website/issues/3230/hovercard" href="https://github.com/openstreetmap/openstreetmap-website/issues/3230">#3230</a>).</li>
<li>Remove the global <code>text-align</code> from our own CSS.</li>
<li>Check the other <code>text-align</code> declarations in our CSS, and see which can be removed.</li>
</ul>
<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />Reply to this email directly, <a href="https://github.com/openstreetmap/openstreetmap-website/issues/3432">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AAK2OLPW3VRMRL5ZYBSPGTTUXACW7ANCNFSM5MMWWM5Q">unsubscribe</a>.<br />Triage notifications on the go with GitHub Mobile for <a href="https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675">iOS</a> or <a href="https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub">Android</a>.
<br />You are receiving this because you are subscribed to this thread.<img src="https://github.com/notifications/beacon/AAK2OLPX4QFT5YLDFLZ3NV3UXACW7A5CNFSM5MMWWM52YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4QQ6LASQ.gif" height="1" width="1" alt="" /><span style="color: transparent; font-size: 0; display: none; visibility: hidden; overflow: hidden; opacity: 0; width: 0; height: 0; max-width: 0; max-height: 0; mso-hide: all">Message ID: <span><openstreetmap/openstreetmap-website/issues/3432</span><span>@</span><span>github</span><span>.</span><span>com></span></span></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/openstreetmap/openstreetmap-website/issues/3432",
"url": "https://github.com/openstreetmap/openstreetmap-website/issues/3432",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>