Skip to content

Commit 8053450

Browse files
authored
Merge pull request #567 from gselderslaghs/tab-button-accessibility
accessibility(Tab & Button) implemented focus states
2 parents 65ddf18 + 7c8fbac commit 8053450

File tree

2 files changed

+27
-12
lines changed

2 files changed

+27
-12
lines changed

sass/components/_buttons.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@
126126

127127
//------------------ Focus
128128

129+
.btn:focus {
130+
background-color: var(--md-sys-color-primary-container);
131+
}
132+
129133
.btn:focus.elevated {
130134
@extend .z-depth-1;
131135
color: var(--md-sys-color-primary);

sass/components/_tabs.scss

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,15 @@
3737

3838
&.tabs-fixed-width {
3939
display: flex;
40+
4041
.tab {
4142
flex-grow: 1;
4243
}
4344
}
4445

4546
position: relative;
4647
overflow-x: auto;
47-
overflow-y: hidden;
48+
overflow-y: hidden;
4849
width: 100%;
4950
background-color: var(--md-sys-color-surface);
5051
margin: 0 auto;
@@ -55,14 +56,14 @@
5556
list-style-type: none;
5657
display: inline-block;
5758
text-align: center;
58-
line-height: 48px;
59+
line-height: 48px;
5960
padding: 0;
6061
margin: 0;
6162

6263
i.material-icons {
6364
position: relative;
64-
top: 8px;
65-
vertical-align: middle;
65+
top: 8px;
66+
vertical-align: middle;
6667
}
6768

6869
span {
@@ -85,15 +86,22 @@
8586
background-color: rgba(var(--md-sys-color-primary-numeric), 0.06);
8687
}
8788

88-
&:focus,
89+
&:focus {
90+
background-color: var(--md-sys-color-primary-container);
91+
}
92+
8993
&.active {
9094
background-color: rgba(var(--md-sys-color-primary-numeric), 0.18);
95+
}
96+
97+
&:focus,
98+
&.active {
9199
outline: none;
92100
}
93101

94102
color: var(--md-sys-color-on-surface-variant);
95103
display: flex;
96-
flex-direction: column;
104+
flex-direction: column;
97105
width: 100%;
98106
height: 100%;
99107
min-height: 48px; //needed for only-icons tabs
@@ -109,6 +117,7 @@
109117
&:not(:focus) {
110118
background-color: transparent;
111119
}
120+
112121
color: var(--md-sys-color-on-surface);
113122
cursor: default;
114123
background-color: transparent;
@@ -123,19 +132,19 @@
123132
will-change: left, right;
124133
border-radius: 3px 3px 0 0;
125134
}
126-
127-
&.tabs-horizontal .tab {
135+
136+
&.tabs-horizontal .tab {
128137
height: 48px;
129138

130139
a {
131140
display: block;
132141
}
133-
142+
134143
i.material-icons {
135144
padding: 0 4px;
136-
position: relative;
137-
top: -2px;
138-
vertical-align: middle;
145+
position: relative;
146+
top: -2px;
147+
vertical-align: middle;
139148
}
140149
}
141150
}
@@ -145,8 +154,10 @@
145154
@media #{$medium-and-down} {
146155
.tabs {
147156
display: flex;
157+
148158
.tab {
149159
flex-grow: 1;
160+
150161
a {
151162
padding: 0 12px;
152163
}

0 commit comments

Comments
 (0)