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 RTL support for checkbox/radio controls #7070

Merged
merged 3 commits into from
Nov 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions packages/core/src/components/forms/_controls.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ $control-indicator-spacing: $pt-grid-size !default;
$padding: $size + $control-indicator-spacing;

&:not(.#{$ns}-align-right) {
padding-left: $padding;
padding-inline-start: $padding;

.#{$ns}-control-indicator {
margin-left: -$padding;
margin-inline-start: -$padding;
}
}

Expand All @@ -112,6 +112,16 @@ $control-indicator-spacing: $pt-grid-size !default;
margin-right: -$padding;
}
}

// special handling for left-aligned indicators in RTL
[dir="rtl"] &.#{$ns}-align-left {
padding-inline-start: 0;
padding-left: $padding;

.#{$ns}-control-indicator {
margin-left: -$padding;
}
}
}

.#{$ns}-control {
Expand All @@ -131,7 +141,7 @@ $control-indicator-spacing: $pt-grid-size !default;

&.#{$ns}-inline {
display: inline-block;
margin-right: $pt-grid-size * 2;
margin-inline-end: $pt-grid-size * 2;
}

input {
Expand All @@ -153,7 +163,7 @@ $control-indicator-spacing: $pt-grid-size !default;
// to reduce property changes needed across types and sizes (large).
font-size: $control-indicator-size;
height: 1em;
margin-right: $control-indicator-spacing;
margin-inline-end: $control-indicator-spacing;
margin-top: -3px;
position: relative;
user-select: none;
Expand Down Expand Up @@ -206,6 +216,11 @@ $control-indicator-spacing: $pt-grid-size !default;
margin-top: 1px;
}

[dir="rtl"] &.#{$ns}-align-left .#{$ns}-control-indicator {
float: left;
margin-top: 1px;
}

&.#{$ns}-large {
@include indicator-position($control-indicator-size-large);
// larger text
Expand All @@ -219,6 +234,10 @@ $control-indicator-spacing: $pt-grid-size !default;
&.#{$ns}-align-right .#{$ns}-control-indicator {
margin-top: 0;
}

[dir="rtl"] &.#{$ns}-align-left .#{$ns}-control-indicator {
margin-top: 0;
}
}

/*
Expand Down