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

Converts CSS to logical properties #646

Merged
merged 2 commits into from
Nov 13, 2024

Conversation

markconroy
Copy link
Member

@markconroy markconroy commented Nov 7, 2024

Closes #628

What does this change?

Removes all instances of things like margin-left, margin-right, etc and use logical properties for them instead, such as margin-inline-start and margin-inline-end.

This will be very beneficial for any site that wants to use languages other than left-to-right languages. It will be even more beneficial if we scale the project beyond UK/Ireland. Oh, and it will also mean a smaller CSS codebase to maintain.

How to test

  • Checkout this branch
  • Load the demo content module
  • Make sure everything looks exactly as it did before

How can we measure success?

We only have to write one set of CSS rules, no matter what direction our language is in.

Have you considered any issues?

This PR changes the names of all our properties such as margin-left but also all our custom variables such as --quote-padding-left: var(--spacing-larger); becoming --quote-padding-inline-start: var(--spacing-larger);.

Solutions - 1: Release Notes

We will need to make sure we have release notes for people to update anywhere they have used those variables (it should be a simple enough find/replace task).

Solutions - 2: Mapped variables

We could create new variables and map those to the old ones, such as:

  • --quote-padding-inline-start: var(--quote-padding-left);

@@ -257,7 +257,7 @@ body {

/* File Upload Items */
--file-upload-border: var(--border);
--file-upload-border-left-size: var(--border-width-large);
--file-upload-border-inline-start-size: var(--border-width-large);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not certain we want to change the variable names. Though I understand the reason for it... It would be good to discuss.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll go with this approach:

Solutions - 2: Mapped variables

We could create new variables and map those to the old ones, such as:

--quote-padding-inline-start: var(--quote-padding-left);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maria I think this is fixed now.

We now have

  1. The old variable so we don't break existing sites, and
  2. The new variable for how we will work from here on ...

@markconroy markconroy merged commit 26ec232 into 1.x Nov 13, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Locigal Properties for all our CSS
2 participants