Skip to content

Commit 870dcd6

Browse files
committed
fix(active): Taps/clicks now use .activated instead of .active, closes #913
Both .active and .activated classes exist within the css now. When a button/link/item is “active”, the .activated class gets added and removed. This is so Ionic is not removing any user defined .active classes, but also so users can use Ionic’s active classes (but not have to worry about them being removed automatically by Ionic). Styled the same by default, but easily overridden.
1 parent 83a2d5f commit 870dcd6

File tree

5 files changed

+18
-10
lines changed

5 files changed

+18
-10
lines changed

js/utils/activator.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
var queueElements = {}; // elements that should get an active state in XX milliseconds
55
var activeElements = {}; // elements that are currently active
66
var keyId = 0; // a counter for unique keys for the above ojects
7+
var ACTIVATED_CLASS = 'activated';
78

89
ionic.activator = {
910

@@ -56,7 +57,7 @@
5657
// activate all elements in the queue
5758
for(var key in queueElements) {
5859
if(queueElements[key]) {
59-
queueElements[key].classList.add('active');
60+
queueElements[key].classList.add(ACTIVATED_CLASS);
6061
activeElements[key] = queueElements[key];
6162
}
6263
}
@@ -66,7 +67,7 @@
6667
function deactivateElements() {
6768
for(var key in activeElements) {
6869
if(activeElements[key]) {
69-
activeElements[key].classList.remove('active');
70+
activeElements[key].classList.remove(ACTIVATED_CLASS);
7071
delete activeElements[key];
7172
}
7273
}

scss/_bar.scss

+3-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@
173173
}
174174
}
175175

176-
&.back-button.active {
176+
&.back-button.active,
177+
&.back-button.activated {
177178
opacity: 1;
178179
}
179180
}
@@ -193,7 +194,7 @@
193194
.title + .button:last-child,
194195
> .button + .button:last-child,
195196
> .button.pull-right,
196-
.buttons.pull-right,
197+
.buttons.pull-right,
197198
.title + .buttons {
198199
position: absolute;
199200
top: 5px;

scss/_button.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@
164164
border-color: transparent;
165165
background: none;
166166

167-
&.button.active {
167+
&.button.active,
168+
&.button.activated {
168169
border-color: transparent;
169170
background: none;
170171
box-shadow: none;
@@ -186,7 +187,8 @@
186187
background: none;
187188
box-shadow: none;
188189

189-
&.active {
190+
&.active,
191+
&.activated {
190192
opacity: 0.3;
191193
}
192194
}

scss/_items.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@
101101
}
102102

103103
// Link and Button Active States
104-
.item.active:not(.item-divider):not(.item-input):not(.item-input-inset),
105-
.item-complex.active .item-content {
104+
.item.active,
105+
.item.activated,
106+
.item-complex.active .item-content,
107+
.item-complex.activated .item-content {
106108
@include item-active-style($item-default-active-bg, $item-default-active-border);
107109

108110
// Different active themes for <a> and <button> items

scss/_mixins.scss

+4-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
color: $color;
1313
text-decoration: none;
1414
}
15-
&.active {
15+
&.active,
16+
&.activated {
1617
border-color: $active-border-color;
1718
background-color: $active-bg-color;
1819
box-shadow: inset 0px 1px 3px rgba(0,0,0,0.15);
@@ -44,7 +45,8 @@
4445
$text-color: $color;
4546
}
4647
color: $text-color;
47-
&.active {
48+
&.active,
49+
&.activated {
4850
background-color: $color;
4951
box-shadow: none;
5052
color: #fff;

0 commit comments

Comments
 (0)