Skip to content

Commit bc360f9

Browse files
bradfrostbmuenzenmeyer
authored andcommitted
Focus states
1 parent 4782cbd commit bc360f9

File tree

5 files changed

+75
-35
lines changed

5 files changed

+75
-35
lines changed

packages/docs/src/scss/abstracts/_mixins.scss

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,71 @@
77
* 1) Prevent Mobile Safari from scaling up text: https://blog.55minutes.com/2012/04/iphone-text-resizing/
88
*/
99
@mixin typographyBody() {
10-
font-family: $font-primary;
11-
font-size: $font-size-med-2;
12-
font-weight: 500;
13-
line-height: 1.6;
14-
-webkit-text-size-adjust: 100%; /* 1 */
10+
font-family: $font-primary;
11+
font-size: $font-size-med-2;
12+
font-weight: 500;
13+
line-height: 1.6;
14+
-webkit-text-size-adjust: 100%; /* 1 */
1515
}
1616

1717
/**
1818
* XL Type Styles
1919
*/
2020
@mixin typographyBodyLarge() {
21-
font-size: $font-size-med-2;
22-
line-height: $line-height-large;
21+
font-size: $font-size-med-2;
22+
line-height: $line-height-large;
2323
}
2424

2525
/**
2626
* XL Heading Styles
2727
*/
2828
@mixin typographyHeadingXl() {
29-
font-weight: $font-weight-bold;
30-
font-size: $font-size-large-2;
31-
line-height: 1.1;
29+
font-weight: $font-weight-bold;
30+
font-size: $font-size-large-2;
31+
line-height: 1.1;
3232

33-
@media all and (min-width: $bp-med) {
34-
font-size: $font-size-xl;
35-
}
33+
@media all and (min-width: $bp-med) {
34+
font-size: $font-size-xl;
35+
}
3636
}
3737

3838
/**
3939
* Large Heading Styles
4040
*/
4141
@mixin typographyHeadingLarge() {
42-
font-size: $font-size-large;
43-
font-weight: 700;
44-
line-height: 1.6;
42+
font-size: $font-size-large;
43+
font-weight: 700;
44+
line-height: 1.6;
4545
}
4646

4747
/**
4848
* Medium 2 Heading Styles
4949
*/
5050
@mixin typographyHeadingMed2() {
51-
font-size: $font-size-med-2;
52-
font-weight: 700;
53-
line-height: 1.2;
51+
font-size: $font-size-med-2;
52+
font-weight: 700;
53+
line-height: 1.2;
5454
}
5555

5656
/**
5757
* Medium Heading Styles
5858
*/
5959
@mixin typographyHeadingMed() {
60-
font-size: $font-size-med;
61-
font-weight: 700;
62-
line-height: 1.2;
60+
font-size: $font-size-med;
61+
font-weight: 700;
62+
line-height: 1.2;
63+
}
64+
65+
/*------------------------------------*\
66+
#FOCUS
67+
\*------------------------------------*/
68+
69+
@mixin focus() {
70+
outline: 2px dotted $color-black;
71+
outline-offset: 4px;
72+
}
73+
74+
@mixin focusInverted() {
75+
outline: 1px dotted $color-white;
76+
outline-offset: 4px;
6377
}

packages/docs/src/scss/base/_buttons.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77
* 1) These should be styled using c-btn
88
*/
99
button {
10-
cursor: pointer;
10+
cursor: pointer;
11+
12+
&:focus {
13+
@include focus();
14+
}
1115
}

packages/docs/src/scss/base/_links.scss

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,20 @@
66
* Link base styles
77
*/
88
a {
9-
color: $color-links;
10-
text-decoration: none;
11-
transition: color $anim-fade-quick $anim-ease;
9+
color: $color-links;
10+
text-decoration: none;
11+
transition: color $anim-fade-quick $anim-ease;
1212

13-
&:hover,
14-
&:focus {
15-
color: $color-links-hover;
16-
}
13+
&:hover,
14+
&:focus {
15+
color: $color-links-hover;
16+
}
1717

18-
&:active {
19-
color: $color-links-active;
20-
}
18+
&:focus {
19+
@include focus();
20+
}
21+
22+
&:active {
23+
color: $color-links-active;
24+
}
2125
}

packages/docs/src/scss/components/_logo.scss

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,18 @@
1717
.c-logo__link {
1818
display: flex;
1919
align-items: center;
20+
21+
&:focus {
22+
@include focusInverted();
23+
}
2024
}
2125

2226
/**
2327
* Logo image
2428
*/
2529
.c-logo__img {
2630
display: block;
27-
max-width: 3rem;
31+
max-width: 2.4rem;
2832
margin-right: 0.5rem;
2933
animation: rotate 10s linear infinite;
3034
}

packages/docs/src/scss/components/_tree-nav.scss

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
}
1111

1212
.c-tree-nav__link {
13-
display: block;
13+
display: flex;
14+
align-items: center;
1415
margin-bottom: 1.2rem;
1516
color: inherit;
1617
font-weight: $font-weight-bold;
@@ -22,6 +23,7 @@
2223

2324
&:focus {
2425
color: $color-white;
26+
@include focusInverted();
2527
}
2628
}
2729

@@ -45,6 +47,14 @@
4547
}
4648
}
4749

50+
.c-tree-nav__icon {
51+
transition: transform $anim-fade-quick $anim-ease;
52+
53+
.c-tree-nav__item.is-active & {
54+
transform: rotate(180deg);
55+
}
56+
}
57+
4858
.c-tree-nav__subnav-link {
4959
color: inherit;
5060
display: block;
@@ -54,6 +64,10 @@
5464
&:focus {
5565
color: $color-white;
5666
}
67+
68+
&:focus {
69+
@include focusInverted();
70+
}
5771
}
5872

5973
.c-tree-nav__link--btn {

0 commit comments

Comments
 (0)