Skip to content

Commit e1d87ff

Browse files
committed
refactor: cross browser layout + overall UI bug fixes
1 parent d66014a commit e1d87ff

File tree

9 files changed

+61
-26
lines changed

9 files changed

+61
-26
lines changed

packages/uikit-workshop/src/html/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html>
2+
<html class="pl-c-html">
33

44
<head>
55
<title id="title">Pattern Lab</title>

packages/uikit-workshop/src/sass/scss/02-base/_body.scss

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
* 1) These exist indepenedent of any project-specific styles
88
* 2) Styled as IDs to avoid collisions with user <body> tag
99
*/
10+
.pl-c-html {
11+
min-height: 100%;
12+
}
13+
1014
.pl-c-body {
1115
margin: 0;
1216
padding: 0;
1317
-webkit-text-size-adjust: 100%;
14-
display: flex;
15-
flex-direction: column;
16-
height: 100vh;
18+
display: flex; // Required for IE 11 to display overall PL layout correctly
1719
}

packages/uikit-workshop/src/sass/scss/03-vendor/_prism.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pre[class*='language-'] {
1616
word-spacing: normal;
1717
word-break: normal;
1818
line-height: 1.5;
19+
word-wrap: normal; // fixes issue in Safari where code blocks can't scroll due to the code breaking into multiple lines unexpectedly
1920

2021
-moz-tab-size: 4;
2122
-o-tab-size: 4;

packages/uikit-workshop/src/sass/scss/04-components/_header.scss

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@
2020
color: $pl-color-gray-50;
2121
font-family: $pl-font;
2222
font-size: $pl-font-size-sm;
23+
min-height: 30px; // magic number -- needed for initial skeleton screen styles used in the critical CSS
24+
25+
@supports(padding: max(0px)) {
26+
padding-left: env(safe-area-inset-left);
27+
padding-right: env(safe-area-inset-right);
28+
}
2329
}
2430

2531
/**

packages/uikit-workshop/src/sass/scss/04-components/_navigation.scss

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
*/
1010
.pl-c-nav {
1111
@include accordionPanel;
12-
background-color: inherit;
12+
background-color: inherit; // allows the nav's children inherit from the parent header
1313
position: absolute;
14+
left: 0; // IE 11 layout broken
1415
top: 100%;
1516
width: 100%;
1617
display: flex;
@@ -37,7 +38,9 @@
3738
}
3839

3940
.pl-c-body--theme-sidebar & {
40-
box-shadow: none;
41+
@media all and (min-width: $pl-bp-med) {
42+
box-shadow: none;
43+
}
4144
}
4245

4346
// if nav was opened on smaller screen and screen is resized, it'll be cut off otherwise
@@ -69,6 +72,7 @@
6972
list-style: none;
7073
flex-shrink: 0; // helps prevent top-level nav items from occasionally wrapping to multiple lines
7174
order: 2;
75+
background-color: inherit; // allows the nav's children inherit from the parent header
7276

7377
@media all and (min-width: $pl-bp-med) {
7478
display: flex; /* 2 */
@@ -85,11 +89,17 @@
8589
* Nav list item
8690
*/
8791
.pl-c-nav__item {
92+
background-color: inherit; // allows the nav's children inherit from the parent header
93+
transform: translateZ(0); // helps with more consistent rendering in Safari
8894
cursor: pointer;
8995
position: relative;
9096
display: flex;
9197
flex-direction: column;
9298
justify-content: center; // vertically align nav items
99+
100+
.pl-c-body--theme-sidebar & {
101+
display: block;
102+
}
93103
}
94104

95105
/**
@@ -107,9 +117,15 @@
107117
* Nav link
108118
*/
109119
.pl-c-nav__link {
120+
@include linkStyle;
110121
display: flex;
111122
align-items: center;
112-
@include linkStyle();
123+
margin: 0; // remove default button margin in Safari
124+
125+
// makes link layout / size more consistent in the sidebar layout, especially when display: flex styles are removed for more consistent IE 11 rendering
126+
.pl-c-body--theme-sidebar & {
127+
width: 100%;
128+
}
113129
}
114130

115131
/**
@@ -126,6 +142,7 @@
126142
* Nav link
127143
*/
128144
.pl-c-nav__link--dropdown {
145+
-webkit-appearance: none; // remove default button styling
129146
flex-grow: 1; // fill up extra space in parent nav item, if available
130147
/**
131148
* Dropdown caret after accordion handle
@@ -171,6 +188,7 @@
171188
* hang over the header
172189
*/
173190
.pl-c-nav__sublist {
191+
background-color: inherit; // allows the nav's children inherit from the parent header
174192
@include listReset();
175193

176194
@media all and (min-width: $pl-bp-med) {

packages/uikit-workshop/src/sass/scss/05-themes/_light-theme.scss

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
border-bottom: 1px solid $pl-color-gray-20;
1616
}
1717

18-
/**
19-
* Nav Sublist dropdown
20-
*/
21-
.pl-c-nav__sublist {
22-
background-color: transparent;
23-
}
24-
2518
/**
2619
* Tools dropdown
2720
*/
2821

2922
// don't show border to the left / bottom when in vertical mode
23+
@media all and (max-width: $pl-bp-med - 1) {
24+
.pl-c-tools__list.pl-is-active {
25+
border-bottom: 1px solid $pl-color-gray-20;
26+
border-left: 1px solid $pl-color-gray-20;
27+
}
28+
}
29+
3030
&:not(.pl-c-body--theme-sidebar) {
3131
.pl-c-tools__list.pl-is-active {
3232
border-bottom: 1px solid $pl-color-gray-20;
@@ -79,13 +79,6 @@
7979
background-color: $pl-color-gray-13 !important;
8080
}
8181

82-
/**
83-
* Typeahead input
84-
*/
85-
.pl-c-typeahead {
86-
background-color: $pl-color-gray-13 !important;
87-
color: $pl-color-gray-70 !important;
88-
}
8982

9083
/**
9184
* Typeahead input

packages/uikit-workshop/src/sass/scss/05-themes/_sidebar-theme.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
border-bottom: 0; /* 4 */
2222
padding: 1rem;
2323
overflow: auto;
24+
-webkit-overflow-scrolling: touch;
2425
justify-content: space-between;
2526
}
2627

@@ -139,10 +140,9 @@
139140
* they appear at the bottom
140141
*/
141142
.pl-c-controls {
142-
display: flex;
143+
display: block; // Display flex + flex direction column gives a similar result, but this fixes a bunch of rendering quirks in IE 11
143144
justify-self: flex-end;
144145
margin-left: 0;
145-
flex-direction: column;
146146
}
147147

148148
.pl-c-viewport-size {

packages/uikit-workshop/src/scripts/components/pl-layout/pl-layout.scss

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
pl-layout {
44
display: flex;
55
flex-direction: column;
6-
height: 100%;
6+
width: 100%;
7+
min-height: 100vh;
8+
max-width: 100vw;
79
background-color: $pl-color-gray-13;
8-
overflow: hidden; // Fix for IE 11 layout bug
10+
11+
// Prevent extra scrollbars in just IE 11
12+
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
13+
overflow: hidden;
14+
}
915

1016
&.pl-c-body--theme-sidebar {
1117
@media all and (min-width: $pl-bp-med) {

packages/uikit-workshop/src/scripts/components/pl-search/pl-search.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,16 @@ pl-search {
8686
width: 100%;
8787
outline-offset: -3px;
8888
outline-width: 2px;
89+
-webkit-appearance: none; // removes default styling (ex. heavy box shadow) in Safari
90+
91+
@media all and (min-width: 900px) {
92+
font-size: inherit;
93+
}
94+
95+
// Remove the native <input> clear button in IE 11 in lieu of JS-controlled clear button
96+
&::-ms-clear {
97+
display: none;
98+
}
8999

90100
.pl-c-body--theme-sidebar & {
91101
border-radius: 0;
@@ -101,7 +111,6 @@ pl-search {
101111
}
102112

103113
@media all and (min-width: $pl-bp-med) {
104-
font-size: inherit;
105114

106115
.pl-c-body--theme-sidebar & {
107116
max-width: none;

0 commit comments

Comments
 (0)