Skip to content

Commit 64c971d

Browse files
committed
fix: workaround fix for the PL UIKit viewport resizer width occasionally getting stuck with a width of 0px in Safari and Firefox when the JS is initially booting up
1 parent cd1d1e0 commit 64c971d

File tree

2 files changed

+65
-63
lines changed

2 files changed

+65
-63
lines changed

packages/uikit-workshop/dist/styleguide/css/pattern-lab.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,7 @@
862862
*/
863863
.pl-c-viewport__iframe-wrapper {
864864
height: 100%;
865+
width: 100%;
865866
position: relative;
866867
margin: 0 auto;
867868
-webkit-box-flex: 1;

packages/uikit-workshop/src/sass/scss/components/_viewport.scss

Lines changed: 64 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@
1313
* 1) This wrapper div occupies all remaining viewport space after PL's header
1414
*/
1515
.pl-c-viewport {
16-
display: flex;
17-
flex-direction: column;
18-
height: 100vh;
19-
width: 100%;
20-
position: relative;
21-
top: $offset-top;
22-
bottom: 0;
23-
left: 0;
24-
right: 0;
25-
z-index: 0;
26-
overflow: hidden;
16+
display: flex;
17+
flex-direction: column;
18+
height: 100vh;
19+
width: 100%;
20+
position: relative;
21+
top: $offset-top;
22+
bottom: 0;
23+
left: 0;
24+
right: 0;
25+
z-index: 0;
26+
overflow: hidden;
2727
}
2828

2929
/**
@@ -32,12 +32,12 @@
3232
* used in JS for manual viewport resizing purposes.
3333
*/
3434
.pl-c-viewport__cover {
35-
width: 100%;
36-
height: 100%;
37-
display: none;
38-
position: absolute;
39-
z-index: 20;
40-
cursor: move;
35+
width: 100%;
36+
height: 100%;
37+
display: none;
38+
position: absolute;
39+
z-index: 20;
40+
cursor: move;
4141
}
4242

4343
/**
@@ -46,80 +46,81 @@
4646
* iframe and the manual resize handle
4747
*/
4848
.pl-c-viewport__iframe-wrapper {
49-
height: 100%;
50-
position: relative;
51-
margin: 0 auto;
52-
flex: 1;
53-
-webkit-overflow-scrolling: touch;
54-
overflow-y: auto;
55-
overflow-x: hidden;
49+
height: 100%;
50+
width: 100%; // bug fix for Safari and Firefox getting stuck calculating a width of 0px when the JS first kicks in
51+
position: relative;
52+
margin: 0 auto;
53+
flex: 1;
54+
-webkit-overflow-scrolling: touch;
55+
overflow-y: auto;
56+
overflow-x: hidden;
5657

57-
&.hay-mode {
58-
transition: all 40s linear;
59-
}
58+
&.hay-mode {
59+
transition: all 40s linear;
60+
}
6061
}
6162

6263
/**
6364
* Viewport iframe
6465
* 1) this is the actual <iframe>
6566
*/
6667
.pl-c-viewport__iframe {
67-
position: absolute;
68-
height: 100%;
69-
width: 100%;
70-
border: 0;
71-
padding: 0;
72-
margin: 0;
73-
top: 0;
74-
bottom: 0;
75-
left: 0;
76-
right: 0;
77-
background-color: $pl-color-white;
68+
position: absolute;
69+
height: 100%;
70+
width: 100%;
71+
border: 0;
72+
padding: 0;
73+
margin: 0;
74+
top: 0;
75+
bottom: 0;
76+
left: 0;
77+
right: 0;
78+
background-color: $pl-color-white;
7879

79-
/**
80+
/**
8081
* Hay Mode transition
8182
* 1) Hay Mode (disabled by default) starts with the smallest
8283
* viewport then slowly expands http://bradfrost.com/blog/post/ish-2-0/
8384
*/
84-
&.hay-mode {
85-
transition: all 40s linear;
86-
}
85+
&.hay-mode {
86+
transition: all 40s linear;
87+
}
8788
}
8889

8990
/**
9091
* Right pull container
9192
* 1) Container used for manual resizing
9293
*/
9394
.pl-c-viewport__resizer {
94-
position: absolute;
95-
right: 0;
96-
top: 0;
97-
bottom: 0;
98-
width: 14px;
99-
margin: 0;
100-
height: 100%;
101-
cursor: ew-resize;
95+
position: absolute;
96+
right: 0;
97+
top: 0;
98+
bottom: 0;
99+
width: 14px;
100+
margin: 0;
101+
height: 100%;
102+
cursor: ew-resize;
102103
}
103104

104105
/**
105106
* Right pull
106107
* 1) This is the handle that lets the user resize the viewport
107108
*/
108109
.pl-c-viewport__resizer-handle {
109-
margin: 0;
110-
width: 100%;
111-
height: 100%;
112-
background: $pl-color-gray-20;
113-
transition: background $pl-animate-quick ease-out;
110+
margin: 0;
111+
width: 100%;
112+
height: 100%;
113+
background: $pl-color-gray-20;
114+
transition: background $pl-animate-quick ease-out;
114115

115-
&:hover {
116-
background: $pl-color-gray-50;
117-
}
116+
&:hover {
117+
background: $pl-color-gray-50;
118+
}
118119

119-
&:active {
120-
cursor: move;
121-
background: $pl-color-gray-70;
122-
}
120+
&:active {
121+
cursor: move;
122+
background: $pl-color-gray-70;
123+
}
123124
}
124125

125126
/**
@@ -128,5 +129,5 @@
128129
* transition the width of the viewport
129130
*/
130131
.vp-animate {
131-
transition: width 0.8s ease-out;
132+
transition: width 0.8s ease-out;
132133
}

0 commit comments

Comments
 (0)