Skip to content

Commit 1c6a9bb

Browse files
authored
fix(ui5-segmentedbutton): add RTL support (#1734)
The change adds RTL support, basically mirrors the borders of the first and the last button.
1 parent 9be085b commit 1c6a9bb

File tree

4 files changed

+35
-4
lines changed

4 files changed

+35
-4
lines changed

packages/main/src/SegmentedButton.hbs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@focusin="{{_onfocusin}}"
44
class="ui5-segmentedbutton-root"
55
role="group"
6+
dir="{{effectiveDir}}"
67
aria-roledescription="{{ariaDescription}}"
78
>
89
<slot></slot>

packages/main/src/themes/SegmentedButton.css

+27-4
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,36 @@
2222
}
2323

2424
::slotted(ui5-togglebutton:last-child) {
25-
border-top-right-radius: 0.375rem;
26-
border-bottom-right-radius: 0.375rem;
25+
border-top-right-radius: var(--_ui5_segmented_btn_border_radius);
26+
border-bottom-right-radius: var(--_ui5_segmented_btn_border_radius);
2727
border-right: 1px solid var(--sapButton_Selected_BorderColor);
2828
}
2929

3030
::slotted(ui5-togglebutton:first-child) {
31-
border-top-left-radius: 0.375rem;
32-
border-bottom-left-radius: 0.375rem;
31+
border-top-left-radius: var(--_ui5_segmented_btn_border_radius);
32+
border-bottom-left-radius: var(--_ui5_segmented_btn_border_radius);
3333
border-left: 1px solid var(--sapButton_Selected_BorderColor);
3434
}
35+
36+
[dir="rtl"] ::slotted(ui5-togglebutton:first-child) {
37+
border-top-right-radius: var(--_ui5_segmented_btn_border_radius);
38+
border-bottom-right-radius: var(--_ui5_segmented_btn_border_radius);
39+
border-top-left-radius: 0;
40+
border-bottom-left-radius: 0;
41+
border-right: 1px solid var(--sapButton_Selected_BorderColor);
42+
}
43+
44+
[dir="rtl"] ::slotted(ui5-togglebutton:last-child) {
45+
border-top-right-radius: 0;
46+
border-bottom-right-radius: 0;
47+
border-top-left-radius: var(--_ui5_segmented_btn_border_radius);
48+
border-bottom-left-radius: var(--_ui5_segmented_btn_border_radius);
49+
border-left: 1px solid var(--sapButton_Selected_BorderColor);
50+
}
51+
52+
[dir="rtl"] ::slotted(ui5-togglebutton:only-child) {
53+
border-top-right-radius: var(--_ui5_segmented_btn_border_radius);
54+
border-bottom-right-radius: var(--_ui5_segmented_btn_border_radius);
55+
border-top-left-radius: var(--_ui5_segmented_btn_border_radius);
56+
border-bottom-left-radius: var(--_ui5_segmented_btn_border_radius);
57+
}

packages/main/src/themes/base/sizes-parameters.css

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
--_ui5-tree-toggle-box-width: 2.75rem;
6767
--_ui5-tree-toggle-box-height: 2.25rem;
6868
--_ui5-tree-toggle-icon-size: 1.0625rem;
69+
70+
/* SegmentedButton */
71+
--_ui5_segmented_btn_border_radius: 0.375rem;
6972
}
7073

7174
[data-ui5-compact-size],

packages/main/test/pages/SegmentedButton.html

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ <h1 class="header-title">ui5-segmentedbutton</h1>
2525
<div class="samples">
2626
<h2>Segmentedbutton example</h2>
2727
<div class="sample" id="main-sample">
28+
<ui5-segmentedbutton id="segButtonSingle">
29+
<ui5-togglebutton>Button</ui5-togglebutton>
30+
</ui5-segmentedbutton>
31+
2832
<section>
2933
<ui5-segmentedbutton id="segButton1">
3034
<ui5-togglebutton icon="employee" pressed></ui5-togglebutton>

0 commit comments

Comments
 (0)