Skip to content

Commit 982b2df

Browse files
cedric07francoistibo
authored andcommitted
Fix postcss RTL and fix associated css rules
1 parent 853bda8 commit 982b2df

File tree

7 files changed

+38
-55
lines changed

7 files changed

+38
-55
lines changed

config/loaders.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ module.exports = {
6464
'postcss-preset-env': {
6565
browsers: 'last 2 versions, > 2%, not dead',
6666
stage: 2,
67+
features: {
68+
// https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values
69+
// https://stackoverflow.com/questions/64565180/how-to-prevent-postcss-preset-env-from-removing-css-logical-properties#answer-66966232
70+
// Use stage 2 features + disable logical properties and values rule
71+
'logical-properties-and-values': false,
72+
},
6773
},
6874
'postcss-pxtorem': { propWhiteList: [] },
6975
'postcss-sort-media-queries': {},

src/scss/02-tools/_m-align.scss

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,8 @@
2121
float: $direction;
2222

2323
@if ($direction == left) {
24-
margin-right: var(--spacing--block-1);
25-
26-
@include rtl {
27-
margin-right: 0;
28-
margin-left: var(--spacing--block-1);
29-
}
24+
margin-inline-end: var(--spacing--block-1);
3025
} @else {
31-
margin-left: var(--spacing--block-1);
32-
33-
@include rtl {
34-
margin-right: var(--spacing--block-1);
35-
margin-left: 0;
36-
}
26+
margin-inline-start: var(--spacing--block-1);
3727
}
3828
}

src/scss/02-tools/_m-checkbox-custom.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,9 @@
2727
+ label {
2828
position: relative;
2929
display: block;
30-
padding-left: $size + 20;
30+
padding-inline-start: $size + 20;
3131
cursor: pointer;
3232

33-
@include rtl {
34-
padding-right: $size + 20;
35-
padding-left: 0;
36-
}
37-
3833
&::before {
3934
position: absolute;
4035
top: 1px;

src/scss/05-components/_searchform.scss

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
position: relative;
77

88
&__field[type="search"] {
9-
padding-right: var(--spacing--block-1);
10-
11-
@include rtl {
12-
padding-right: 0;
13-
padding-left: var(--spacing--block-1);
14-
}
9+
padding-inline-end: var(--spacing--block-1);
1510
}
1611

1712
&__submit {
Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
11
.skip-links {
2-
position: absolute;
2+
position: fixed;
33
top: var(--wp-admin-bar-height);
44
left: 0;
5-
z-index: 10;
6-
display: flex;
7-
padding: .5rem 1rem;
8-
color: $color-text;
5+
z-index: 11; // Under header
6+
width: 100%;
7+
padding: 8px 10px 10px;
98
background-color: $color-primary;
109
opacity: 0;
1110
transition: transform .3s $ease-out-expo, opacity .3s;
1211
transform: translate3d(0, -100%, 0);
1312

13+
ul {
14+
display: flex;
15+
list-style: none;
16+
}
17+
18+
a {
19+
font-size: 13px;
20+
color: $color-text;
21+
text-decoration: none;
22+
23+
&:focus {
24+
outline-offset: 3px;
25+
}
26+
}
27+
1428
&:focus-within {
1529
opacity: 1;
1630
transform: translate3d(0, 0, 0);
1731
}
1832

1933
li:not(:last-of-type) {
20-
margin-right: 1rem;
21-
22-
@include rtl {
23-
margin-right: 0;
24-
margin-left: 1rem;
25-
}
34+
margin-inline-end: 1rem;
2635
}
2736
}

src/scss/06-blocks/core/_quote.scss

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
.wp-block-quote {
2+
// Override for WordPress base wp-block-quote style for RTL compatibility
3+
padding-left: 0;
4+
padding-inline-start: 20px; // stylelint-disable-line order/properties-order
5+
border-left: 0;
6+
border-inline-start: 5px solid currentColor; // stylelint-disable-line order/properties-order
7+
28
// p {
39
// ...
410
// }
511
// &__citation,
612
// cite {
713
// ...
814
// }
9-
10-
// For WordPress base wp-block-quote style
11-
@include rtl {
12-
padding-right: 1em;
13-
padding-left: 0;
14-
border-right: .25em solid currentColor;
15-
border-left: 0;
16-
}
1715
}

src/scss/08-template-parts/_header.scss

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -284,25 +284,15 @@
284284
}
285285

286286
+ li {
287-
margin-left: 28px;
288-
289-
@include rtl {
290-
margin-right: 28px;
291-
margin-left: 0;
292-
}
287+
margin-inline-start: 28px;
293288
}
294289

295290
&.menu-item-has-children {
296291
padding-bottom: 38px;
297292

298293
> a {
299294
max-width: none;
300-
margin-right: 14px;
301-
302-
@include rtl {
303-
margin-right: 0;
304-
margin-left: 14px;
305-
}
295+
margin-inline-end: 14px;
306296
}
307297
}
308298
}

0 commit comments

Comments
 (0)