Skip to content

Commit d3361b2

Browse files
committed
Ot_popup: fix content shift when popup opens
position: fixed on body removes it from the normal flow, losing its implicit 100% width. Add width: 100% to preserve the layout and prevent horizontal content shift.
1 parent 0630e67 commit d3361b2

File tree

1 file changed

+51
-37
lines changed

1 file changed

+51
-37
lines changed

css/ot_popup.css

Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,76 @@
1-
html.ot-with-popup, html.ot-with-popup > body {
1+
html.ot-with-popup,
2+
html.ot-with-popup>body {
23
overflow: hidden;
4+
position: fixed;
5+
/* To prevent scroll on mobile devices.
6+
One must also set top property manually
7+
to prevent scrolling page to top. */
8+
width: 100%;
39
}
10+
411
.ot-popup-background {
5-
position: fixed ;
6-
right: 0 ;
7-
left: 0 ;
8-
top: 0 ;
9-
bottom: 0 ;
10-
z-index: 1 ;
11-
background-color: rgba(0, 0, 0, 0.6) ;
12-
display: flex ;
12+
position: fixed;
13+
right: 0;
14+
left: 0;
15+
top: 0;
16+
bottom: 0;
17+
z-index: 1;
18+
background-color: rgba(0, 0, 0, 0.6);
19+
display: flex;
1320
}
21+
1422
.ot-popup {
15-
position: relative ;
16-
margin: auto ;
17-
z-index: 2 ;
18-
display: flex ;
19-
max-height: 100% ;
20-
min-height: 2em ; /* .ot-popup-close button */
21-
overflow: auto ;
22-
background-color: #FFFFFF ;
23+
position: relative;
24+
margin: auto;
25+
z-index: 2;
26+
display: flex;
27+
max-height: 100%;
28+
min-height: 2em;
29+
/* .ot-popup-close button */
30+
overflow: auto;
31+
background-color: #FFFFFF;
2332
padding: .5em;
2433
border-radius: 2px;
2534
}
35+
2636
.ot-popup-close {
27-
position: absolute ;
28-
top: 0 ;
29-
right: 0 ;
30-
background: transparent ;
31-
border: none ;
37+
position: absolute;
38+
top: 0;
39+
right: 0;
40+
background: transparent;
41+
border: none;
3242
cursor: pointer;
33-
z-index: 2 ;
34-
padding: 5px ;
43+
z-index: 2;
44+
padding: 5px;
3545
}
3646

3747
.ot-popup-content {
38-
width: 100% ;
39-
flex: 1 1 auto ;
40-
overflow: auto ;
41-
display: flex ;
48+
width: 100%;
49+
flex: 1 1 auto;
50+
overflow: auto;
51+
display: flex;
4252
}
53+
4354
.ot-hcf {
44-
width: 100% ;
45-
display: flex ;
46-
flex-direction: column ;
47-
flex-wrap: nowrap ;
48-
align-items: stretch ;
49-
overflow: auto ;
55+
width: 100%;
56+
display: flex;
57+
flex-direction: column;
58+
flex-wrap: nowrap;
59+
align-items: stretch;
60+
overflow: auto;
5061
}
62+
5163
.ot-hcf-header,
5264
.ot-hcf-footer {
53-
flex-shrink: 0 ;
65+
flex-shrink: 0;
5466
}
67+
5568
.ot-hcf-header:empty,
5669
.ot-hcf-footer:empty {
57-
display: none ;
70+
display: none;
5871
}
72+
5973
.ot-hcf-content {
6074
flex-grow: 1;
6175
overflow: auto;
62-
}
76+
}

0 commit comments

Comments
 (0)