Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 9bcb82d

Browse files
toger5jryans
andauthored
Add CSS variable to make the UI gaps consistent and fix the resize handle position (#7234)
Co-authored-by: J. Ryan Stinnett <[email protected]>
1 parent 1200006 commit 9bcb82d

File tree

8 files changed

+34
-26
lines changed

8 files changed

+34
-26
lines changed

res/css/_common.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ $slider-dot-size: 1em;
3333
$slider-selection-dot-size: 2.4em;
3434

3535
$container-border-width: 8px;
36+
$container-gap-width: 8px; // only even numbers should be used because otherwise we get 0.5px margin values.
3637

3738
$timeline-image-border-radius: 8px;
3839
:root {

res/css/structures/_MainSplit.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ limitations under the License.
2323
}
2424

2525
.mx_MainSplit > .mx_RightPanel_ResizeWrapper {
26-
// no padding on the left. The spacing is taken care of by the main split content.
27-
padding: 5px 5px 5px 0px;
28-
margin-left: 8px;
26+
padding: $container-gap-width;
27+
padding-left: calc($container-gap-width / 2); // The resizer should be centered: only half of the gap-width is handled by the right panel. The other half by the RoomView.
2928
height: calc(100vh - 51px); // height of .mx_RoomHeader.light-panel
3029

3130
&:hover .mx_ResizeHandle_horizontal::before {
3231
position: absolute;
3332
top: 50%;
34-
transform: translate(0, -50%);
33+
left: 50%;
34+
transform: translate(-50%, -50%);
3535

3636
height: 64px; // to match width of the ones on roomlist
3737
width: 4px;

res/css/structures/_MatrixChat.scss

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,14 +76,28 @@ limitations under the License.
7676
height: 100%;
7777
}
7878

79+
// We'd like to remove this, but this makes matrixchat's resizehandle's
80+
// negative margin greater than its positive padding. If it's the same
81+
// or less, Safari and other WebKit based browsers get confused about overflows somehow and
82+
// https://github.com/vector-im/element-web/issues/19863 happens.
83+
.mx_MatrixChat > .mx_ResizeHandle.mx_ResizeHandle_horizontal {
84+
margin: 0 calc(-5.5px - $container-gap-width / 2) 0 calc(-6.5px + $container-gap-width / 2);
85+
// The condition to prevent bleeding is: (margin-left + margin-right < -11px) (IF there is NO margin on the leftPanel_wrapper)
86+
// The resizeHandle does not change the gap between the left panel and the room view:
87+
// the resizeHandle width is: 11px = 10px (padding) + 1px (width) and the total negative margin is -12px -> the handle requires no space
88+
// right: -6px left: -6px positions the element exactly on the edge of leftPanel.
89+
// left+=1 and right-=1 => resizeHandle moves 1px to the right closer to the center of the gap.
90+
// We want the handle to be in the middle of the gap so it is shifted by ($container-gap-width / 2)
91+
}
92+
7993
.mx_MatrixChat > .mx_ResizeHandle_horizontal:hover {
8094
position: relative;
8195

8296
&::before {
8397
position: absolute;
84-
left: 6px;
8598
top: 50%;
86-
transform: translate(0, -50%);
99+
left: 50%;
100+
transform: translate(-50%, -50%);
87101

88102
height: 64px; // to match width of the ones on roomlist
89103
width: 4px;

res/css/structures/_RoomView.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ limitations under the License.
166166
flex: 1;
167167
display: flex;
168168
flex-direction: column;
169+
margin-right: calc($container-gap-width / 2);
169170
}
170171

171172
.mx_RoomView_statusArea {

res/css/views/elements/_ResizeHandle.scss

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,6 @@ limitations under the License.
2020
z-index: 100;
2121
}
2222

23-
// We'd like to remove this, but this makes matrixchat's resizehandle's
24-
// negative margin & greater than its positive padding. If it's the same
25-
// or less, Safari gets confused about overflows somehow and
26-
// https://github.com/vector-im/element-web/issues/19863 happens.
27-
.mx_MatrixChat > .mx_ResizeHandle.mx_ResizeHandle_horizontal {
28-
margin: 0 -10px 0 0;
29-
padding: 0 8px 0 0;
30-
}
31-
3223
.mx_ResizeHandle.mx_ResizeHandle_horizontal {
3324
margin: 0 -5px;
3425
padding: 0 5px;

res/css/views/rooms/_AppsDrawer.scss

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@ limitations under the License.
1818
$MiniAppTileHeight: 200px;
1919

2020
.mx_AppsDrawer {
21-
margin: 5px;
21+
margin: $container-gap-width;
22+
margin-right: calc($container-gap-width / 2); // The left side gap is fully handled by this margin. To prohibit bleeding on webkit browser.
2223
margin-bottom: 0; // No bottom margin for the correct gap to the CallView below.
23-
margin-left: 13px; // 5+8px to compensate for the scroll bar padding on the right.
2424
position: relative;
2525
display: flex;
2626
flex-direction: column;
2727
overflow: hidden;
2828
flex-grow: 1;
2929

30+
&.mx_AppsDrawer_maximise {
31+
margin-bottom: $container-gap-width;
32+
}
33+
3034
.mx_AppsContainer_resizerHandleContainer {
3135
width: 100%;
3236
height: 10px;
33-
margin-top: -3px; // move it up so the interactions are slightly more comfortable
3437
display: block;
3538
position: relative;
3639
}
@@ -44,7 +47,7 @@ $MiniAppTileHeight: 200px;
4447

4548
// This is positioned directly below frame
4649
position: absolute;
47-
bottom: 0 !important; // override from library
50+
bottom: 50% !important; // override from library
4851

4952
// We then render the pill handle in an ::after to keep it in the handle's
5053
// area without being a massive line across the screen
@@ -53,8 +56,7 @@ $MiniAppTileHeight: 200px;
5356
position: absolute;
5457
border-radius: 3px;
5558

56-
// The combination of these two should make the pill 4px high
57-
top: 6px;
59+
height: 4px;
5860
bottom: 0;
5961

6062
// Together, these make the bar 64px wide
@@ -89,7 +91,7 @@ $MiniAppTileHeight: 200px;
8991
}
9092

9193
.mx_AppsContainer_resizer {
92-
margin-bottom: 8px;
94+
margin-bottom: $container-gap-width;
9395
}
9496

9597
.mx_AppsContainer {

res/css/views/voip/_CallView.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ limitations under the License.
2626

2727
.mx_CallView_large {
2828
padding-bottom: 10px;
29-
margin: 5px 5px 5px 13px;
29+
margin: $container-gap-width;
30+
margin-right: calc($container-gap-width / 2); // The left side gap is fully handled by this margin. To prohibit bleeding on webkit browser.
31+
margin-bottom: 10px;
3032
display: flex;
3133
flex-direction: column;
3234
flex: 1;

res/css/views/voip/_CallViewForRoom.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ limitations under the License.
1919

2020
.mx_CallViewForRoom_ResizeWrapper {
2121
display: flex;
22-
margin-bottom: 8px;
2322

2423
&:hover .mx_CallViewForRoom_ResizeHandle {
2524
// Need to use important to override element style attributes
@@ -31,8 +30,6 @@ limitations under the License.
3130

3231
&::after {
3332
content: '';
34-
margin-top: 3px;
35-
3633
border-radius: 4px;
3734

3835
height: 4px;

0 commit comments

Comments
 (0)