Skip to content

Commit 1dbbd8c

Browse files
fix: [issue 669] Padding bug on pfe-cta in IE & Edge (#665)
* [issue 664] moving padding to href and adding z-index to span wrappers for links in IE and edge; adjusted lightdom styles to read padding * added padding to modal slot, fixed links in edge * removed lightdom styles that were causing a bug on the secondary focus state for edge and IE11 * added IE11 & edge fallback styles for pfe-cta * added safari fallback styles for focus states on priority ctas * put inner focus border on priority CTAs only Co-authored-by: Kendall Totten <[email protected]>
1 parent 88b26ed commit 1dbbd8c

File tree

3 files changed

+113
-37
lines changed

3 files changed

+113
-37
lines changed

elements/pfe-cta/package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

elements/pfe-cta/src/pfe-cta--lightdom.scss

Lines changed: 90 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ $LOCAL: cta;
88

99
/*************************/
1010
/** Set link tag styles for IE11 & EDGE **/
11-
[class^="pfe-cta"][class="PFElement"],
11+
1212
.pfe-cta--wrapper {
1313
a,
1414
a:visited {
1515
font-family: #{pfe-var(font-family)};
1616
display: inline;
17-
color: #{pfe-local($cssvar: Color, $fallback: #{pfe-color(link)})} !important;
17+
color: #{pfe-local(
18+
$cssvar: Color, $fallback: #{pfe-color(link)}
19+
)} !important;
1820
z-index: 1; // IE & Edge need this for the link to be clickable
1921
position: relative;
2022
}
@@ -25,20 +27,23 @@ $LOCAL: cta;
2527
input:hover,
2628
button:hover,
2729
a:hover {
28-
color: #{pfe-local($cssvar: Color--hover, $fallback: #{pfe-color(link--hover)})} !important;
30+
color: #{pfe-local(
31+
$cssvar: Color--hover, $fallback: #{pfe-color(link--hover)}
32+
)} !important;
2933
}
3034

3135
&:focus input,
3236
&:focus button,
3337
&:focus a,
3438
input:focus,
35-
button:focus,
36-
a:focus {
39+
a:focus,
40+
button:focus {
3741
color: #{pfe-local(
3842
$cssvar: Color--focus, $fallback: #{pfe-color(link--focus)},
3943
)} !important;
4044
}
41-
45+
}
46+
[pfe-priority] .pfe-cta--wrapper {
4247
a:focus {
4348
outline: none !important;
4449
&::before { // inner border on priority CTAs
@@ -47,7 +52,7 @@ $LOCAL: cta;
4752
box-sizing: border-box;
4853
border: 1px solid;
4954
border-color: #{pfe-local(
50-
$cssvar: inner--BorderColor, $fallback: #{pfe-color(link--on-dark)},
55+
$cssvar: inner--BorderColor, $fallback: (Color),
5156
)};
5257
outline: none;
5358
position: absolute;
@@ -64,26 +69,35 @@ $LOCAL: cta;
6469
}
6570
}
6671

67-
[class^="pfe-cta"][class="PFElement"][pfe-priority], //ie11
72+
// targeting default cta's
73+
.pfe-cta--wrapper {
74+
padding: 0 !important;
75+
}
76+
77+
// removing padding from wrapper and placing it on link
78+
[pfe-priority] .pfe-cta--wrapper {
79+
padding: 0 !important;
80+
}
81+
82+
[class^="pfe-cta"][class="PFElement"][pfe-priority],
6883
[pfe-priority] .pfe-cta--wrapper {
6984
a,
7085
input {
7186
text-decoration: none;
87+
padding: #{pfe-local(
88+
$cssvar: Padding, $fallback: (16px 32px),
89+
)} !important;
7290
}
7391
}
7492

75-
[class^="pfe-cta"][class="PFElement"][pfe-priority="secondary"] { //ie11
76-
background-color: #{pfe-local(
77-
$cssvar: BackgroundColor, $fallback: #{pfe-color(surface--lightest)}
78-
)};
79-
}
80-
8193
[class^="pfe-cta"][class="PFElement"][pfe-priority="secondary"], //ie11
8294
[pfe-priority="secondary"] .pfe-cta--wrapper {
8395
input,
8496
button,
8597
a {
86-
color: #{pfe-local($cssvar: Color, $fallback: #{pfe-color(text)})} !important;
98+
color: #{pfe-local(
99+
$cssvar: Color, $fallback: #{pfe-color(text)}
100+
)} !important;
87101
}
88102

89103
&:hover input,
@@ -92,11 +106,33 @@ $LOCAL: cta;
92106
input:hover,
93107
button:hover,
94108
a:hover {
95-
color: #{pfe-local($cssvar: Color--hover, $fallback: #{pfe-color(link--on-saturated)})} !important;
109+
color: #{pfe-local(
110+
$cssvar: Color--hover, $fallback: #{pfe-color(link--on-saturated)}
111+
)} !important;
112+
}
113+
@include browser-query(edge) {
114+
a:focus {
115+
color: #{pfe-local(
116+
$cssvar: Color--focus, $fallback: #{pfe-color(link--focus)},
117+
)} !important;
118+
}
119+
}
120+
}
121+
122+
@include browser-query(edge) {
123+
.pfe-cta--arrow.pfe-cta {
124+
top: .25rem;
125+
width: 18px;
126+
height: 18px;
96127
}
97128
}
98129

99130
@include browser-query(ie11) {
131+
[class^="pfe-cta"] .pfe-cta--arrow.pfe-cta {
132+
top: .35rem;
133+
width: 16px;
134+
height: 20px;
135+
}
100136
pfe-cta.PFElement{
101137
button {
102138
background-color: transparent !important;
@@ -106,14 +142,50 @@ $LOCAL: cta;
106142
}
107143
&[pfe-priority="primary"] {
108144
a, a:visited, a:focus, a:hover {
109-
color: #{pfe-color(link--on-saturated)} !important;
145+
color: #{pfe-local(
146+
$cssvar: Color, $fallback: #{pfe-color(link--on-saturated)},
147+
)} !important;
110148
}
111149
}
112150
&[pfe-priority="primary"][pfe-color="lightest"],
151+
&[pfe-priority="secondary"][pfe-color="lightest"] {
152+
border-color: #{pfe-local(
153+
$cssvar: BorderColor,
154+
$fallback: #{pfe-color(surface--darkest)},
155+
)} !important;
156+
a {
157+
color: #{pfe-local(
158+
$cssvar: Color,
159+
$fallback: #{pfe-color(text)},
160+
)} !important;
161+
}
162+
a:hover {
163+
color: #{pfe-local(
164+
$cssvar: Color,
165+
$fallback: #{pfe-color(ui-complement)},
166+
)} !important;
167+
}
168+
}
113169
&[pfe-priority="secondary"][pfe-variant="wind"] {
114170
a, a:visited, a:focus, a:hover {
115-
color: #{pfe-color(link)} !important;
171+
color: #{pfe-local(
172+
$cssvar: Color,
173+
$fallback: #{pfe-color(link)},
174+
)} !important;
116175
}
117176
}
118177
}
119178
}
179+
180+
// Fallback styles for safari to read a border on focus
181+
@media screen and (-webkit-min-device-pixel-ratio: 0) {
182+
::-webkit-full-page-media, _:future, :root, a {
183+
border: 1px solid transparent;
184+
}
185+
[pfe-priority] {
186+
a:focus {
187+
border-color: #{pfe-local($cssvar: BorderColor--focus, $region: inner)};
188+
border-radius: 2px;
189+
}
190+
}
191+
}

elements/pfe-cta/src/pfe-cta.scss

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ $pfe-cta--Color--fallback: #003366;
99
$variables: (
1010
Padding: .6rem 0,
1111
BorderRadius: 0,
12-
1312
BackgroundColor: transparent,
1413
BackgroundColor--hover: transparent,
1514
BackgroundColor--focus: transparent,
@@ -55,7 +54,6 @@ $variables: (
5554
background-color: #{pfe-local(BackgroundColor)};
5655
border-radius: #{pfe-local(BorderRadius)};
5756
border: #{pfe-var(ui--border-width)} #{pfe-var(ui--border-style)} #{pfe-local(BorderColor)};
58-
padding: #{pfe-local($cssvar: Padding)} !important;
5957
}
6058

6159
::slotted(button),
@@ -65,14 +63,13 @@ $variables: (
6563

6664
::slotted(*) {
6765
display: inline;
68-
66+
padding: #{pfe-local($cssvar: Padding)} !important;
6967
color: #{pfe-local(Color, $pfe-cta--Color--fallback)} !important;
7068
font-family: #{pfe-local($cssvar: FontFamily, $fallback: #{pfe-var(font-family--heading)})};
7169
font-size: #{pfe-local($cssvar: FontSize, $fallback: #{pfe-var(font-size)})};
7270
font-weight: #{pfe-local(FontWeight)};
7371
line-height: #{pfe-local($cssvar: LineHeight, $fallback: #{pfe-var(line-height)})};
7472
text-decoration: #{pfe-local(TextDecoration)} !important;
75-
7673
&::before { // inner border on priority CTAs
7774
content: "";
7875

@@ -86,7 +83,6 @@ $variables: (
8683

8784
border: #{pfe-var(surface--border-width)} #{pfe-var(surface--border-style)} #{pfe-local($cssvar: BorderColor, $region: inner)};
8885
border-radius: 2px;
89-
9086
outline: none;
9187
}
9288
}
@@ -108,7 +104,7 @@ $variables: (
108104

109105
::slotted(:hover) {
110106
--pfe-cta__arrow--Padding: 0 0 0 .5rem;
111-
107+
112108
color: #{pfe-local(Color--hover)} !important;
113109
text-decoration: #{pfe-local(TextDecoration--hover)} !important;
114110
}
@@ -127,13 +123,14 @@ $variables: (
127123
}
128124
}
129125

126+
127+
130128
:host(::after) {
131129
margin-left: #{pfe-local($cssvar: MarginLeft, $region: arrow)};
132130
}
133131

134132
:host(:hover) {
135133
--pfe-cta__arrow--Padding: 0 0 0 .5rem;
136-
137134
background-color: #{pfe-local(BackgroundColor--hover)};
138135
border-color: #{pfe-local(BorderColor--hover)};
139136

@@ -223,7 +220,7 @@ $variables: (
223220

224221
--pfe-cta--BackgroundColor--focus: #{pfe-color(surface--lighter)};
225222
--pfe-cta--BorderColor--focus: #{pfe-color(ui-complement)};
226-
--pfe-cta__inner--BorderColor--focus: var(--pfe-broadcasted--text, #{pfe-color(ui-complement)});
223+
--pfe-cta__inner--BorderColor--focus: #{pfe-color(ui-complement)};
227224
--pfe-cta--Color--focus: #{pfe-color(ui-complement)};
228225
}
229226

@@ -335,10 +332,10 @@ $variables: (
335332
/// ===========================================================================
336333
/// COLOR=BASE
337334

338-
// :host(:not([pfe-priority])[pfe-color="complement"]) {
339-
// --pfe-cta--Color: #{pfe-color(ui-base)};
340-
// --pfe-cta--Color--hover: #{pfe-color(ui-base--hover)};
341-
// }
335+
:host(:not([pfe-priority])[pfe-color="complement"]) {
336+
--pfe-cta--Color: #{pfe-color(ui-base)};
337+
--pfe-cta--Color--hover: #{pfe-color(ui-base--hover)};
338+
}
342339

343340
:host([pfe-priority="primary"][pfe-color="base"]) {
344341
--pfe-cta--BackgroundColor: #{pfe-color(ui-base)};
@@ -440,3 +437,10 @@ $variables: (
440437
--pfe-cta__inner--BorderColor--focus: #{pfe-local(BorderColor--focus)};
441438
--pfe-cta--TextDecoration--hover: #{pfe-broadcasted(link-decoration--hover)};
442439
}
440+
441+
/// ===========================================================================
442+
/// MODALS
443+
/// ===========================================================================
444+
:host([slot="pfe-modal--trigger"]) {
445+
padding: #{pfe-local($cssvar: Padding)} !important;
446+
}

0 commit comments

Comments
 (0)