Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public - FE - Right to Left (RTL) - Add property #4584

Open
ludtkemorgan opened this issue Jan 16, 2025 · 2 comments
Open

Public - FE - Right to Left (RTL) - Add property #4584

ludtkemorgan opened this issue Jan 16, 2025 · 2 comments
Assignees
Labels
ready validated Legitimate bug or issue

Comments

@ludtkemorgan
Copy link
Collaborator

ludtkemorgan commented Jan 16, 2025

In order to support Arabic on the site we need to support right to left (RTL) functionality.

In the Detroit repo, the majority of this was accomplished by setting the site "dir" when Arabic is selected. We also added an RTL Tailwind extension. There were a few places we had to directly customize CSS to manage RTL changes.

For this ticket, we'll just add the dir property. We won't be able to QA this until the new frontend work is in, so once this is added we'll be able to QA RTL in the UI as we go.

  1. Add the "dir" property if Arabic is selected
if (locale && locale === "ar") {
      if (document.body.getAttribute("dir") !== "rtl") {
        document.body.setAttribute("dir", "rtl")
      }
    } else {
      document.body.removeAttribute("dir")
    }
@emilyjablonski emilyjablonski changed the title Public - Add right to left functionality Public - FE - Right to Left (RTL) Jan 22, 2025
@emilyjablonski
Copy link
Collaborator

emilyjablonski commented Jan 22, 2025

We haven't tested seeds with RTL functionality. It's likely we will need to build RTL compatibility into seeds, which could require seeds changes to make class name adjustments from things like margin-left to margin-inline-start. We can add the dir and see what it looks like first, but we will need to do this seeds work as well. We might need to norm about margin-inline-start/end and margin-block-start/end over left/right in CSS.

@emilyjablonski emilyjablonski added the validated Legitimate bug or issue label Jan 22, 2025
@emilyjablonski emilyjablonski changed the title Public - FE - Right to Left (RTL) Public - FE - Right to Left (RTL) - Add property Jan 22, 2025
@jaredcwhite
Copy link
Collaborator

jaredcwhite commented Jan 27, 2025

Just adding a note that dir is best set on the root html element, not body per se:
https://www.w3.org/International/questions/qa-html-dir.en

Perhaps there's a reason it was on body in the previous repo, but I'll go into this assuming we should go with best practice. I'm also going to use an array of rtl languages rather than hard-coding a single ar check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready validated Legitimate bug or issue
Projects
None yet
Development

No branches or pull requests

3 participants