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

Add stylelint rule to prevent usage of flex-direction reverse values #63081

Merged
merged 12 commits into from
Jul 30, 2024
10 changes: 9 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
"at-rule-empty-line-before": null,
"at-rule-no-unknown": null,
"comment-empty-line-before": null,
"declaration-property-value-allowed-list": [
{
"flex-direction": "/^(?!(row|column)-reverse).*$/"
},
{
"message": "Avoid the flex-direction reverse values. For accessibility reasons, visual, reading, and DOM order must match. Only use the reverse values when they do not affect reading order, meaning, and interaction."
}
],
"declaration-property-value-disallowed-list": [
{
"/.*/": [ "/--wp-components-color-/" ]
Expand All @@ -18,7 +26,7 @@
"property-disallowed-list": [
[ "order" ],
{
"message": "Avoid the order property. For accessibility reasons, visual, reading, and DOM order must match. Only use the order property when it does not affect reading order, meaning, and interaction"
"message": "Avoid the order property. For accessibility reasons, visual, reading, and DOM order must match. Only use the order property when it does not affect reading order, meaning, and interaction."
}
],
"rule-empty-line-before": null,
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/hooks/block-hooks.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* we need to right-align the toggle.
*/
.components-toggle-control .components-h-stack {
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the row-reverse value. */
flex-direction: row-reverse;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
}

.use-editor-wrapper-styles--reversed {
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the column-reverse value. */
flex-direction: column-reverse;
width: 100%;
max-width: 580;
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/form-input/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
&:has(input[type="checkbox"]) {
width: fit-content;
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the row-reverse value. */
flex-direction: row-reverse;
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/block-library/src/media-text/style.native.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ $media-to-text: 12px;
}

.has-media-on-the-right {
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the row-reverse value. */
flex-direction: row-reverse;
}

.is-stacked-on-mobile {
flex-direction: column;

&.has-media-on-the-right {
/* stylelint-disable-next-line declaration-property-value-allowed-list -- This should be refactored to not use the column-reverse value. */
flex-direction: column-reverse;
}
}
Expand Down
Loading