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

refactor: replace right/left with inline corresponding values for better RTL support #560

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shuuji3
Copy link

@shuuji3 shuuji3 commented Jun 9, 2024

Hello, I've noticed that there are still dozens of usages of right or left for positioning, instead of inline-start or inline-end.

This PR replaces those with inline-* corresponding. Using inline-* variants will improve support for RTL languages and can simplify CSS properties in some cases.

IE didn't support inline-* variants but IE reached EoL and Pico CSS v2 dropped its support and all modern browsers support inline-* so now we should be able to use inline-* values everywhere.

(Let me know if this PR is too large. I can split it into small pieces if you like.)

@@ -1108,7 +1103,6 @@ td {
background-color: var(--pico-background-color);
color: var(--pico-color);
font-weight: var(--pico-font-weight);
text-align: left;
Copy link
Author

Choose a reason for hiding this comment

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

left and start are identical so they are not needed at the current time when IE doesn't exist.

Comment on lines -1432 to -1433
padding-right: calc(var(--pico-form-element-spacing-horizontal) + 1.5rem) !important;
padding-left: var(--pico-form-element-spacing-horizontal);
Copy link
Author

Choose a reason for hiding this comment

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

same redundancy for IE

background-image: none !important;
}
}
[dir=rtl] :is([type=date], [type=datetime-local], [type=month], [type=time], [type=week]) {
text-align: right;
text-align: start;
Copy link
Author

Choose a reason for hiding this comment

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

start in [dir=rtl] is the right position.

padding: calc(var(--pico-block-spacing-vertical) * 0.66) var(--pico-block-spacing-horizontal);
background-color: var(--pico-card-sectioning-background-color);
}
article > header {
margin-top: calc(var(--pico-block-spacing-vertical) * -1);
margin-bottom: var(--pico-block-spacing-vertical);
border-bottom: var(--pico-border-width) solid var(--pico-card-border-color);
border-top-right-radius: var(--pico-border-radius);
border-top-left-radius: var(--pico-border-radius);
border-start-start-radius: var(--pico-border-radius);
Copy link
Author

Choose a reason for hiding this comment

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

This might be confusing but border-*-*-radius has also inline/block corresponding.

ref. https://developer.mozilla.org/en-US/docs/Web/CSS/border-end-end-radius

Comment on lines +667 to +668
margin-inline: auto;
padding-inline: var(--pico-spacing);
Copy link
Author

Choose a reason for hiding this comment

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

*-right and *-left can be merged into *-inline.

@shuuji3 shuuji3 changed the title chore: replace right/left with inline-* value for better rtl support refactor: replace right/left with inline-* value for better rtl support Jun 9, 2024
@shuuji3 shuuji3 changed the title refactor: replace right/left with inline-* value for better rtl support refactor: replace right/left with inline corresponding values for better rtl support Jun 9, 2024
@shuuji3 shuuji3 changed the title refactor: replace right/left with inline corresponding values for better rtl support refactor: replace right/left with inline corresponding values for better RTL support Jun 9, 2024
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.

None yet

1 participant