Skip to content

Commit 17c0543

Browse files
committed
perf(toggle): toggle’s button is not activated
1 parent ea8213b commit 17c0543

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/components/toggle/toggle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const TOGGLE_VALUE_ACCESSOR: any = {
7070
'[attr.aria-checked]="_value" ' +
7171
'[attr.aria-labelledby]="_labelId" ' +
7272
'[attr.aria-disabled]="_disabled" ' +
73-
'class="item-cover">' +
73+
'class="item-cover" disable-activated>' +
7474
'</button>',
7575
host: {
7676
'[class.toggle-disabled]': '_disabled'

src/tap-click/activator.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import { PointerCoordinates } from '../util/dom';
66

77

88
export class Activator implements ActivatorBase {
9+
910
protected _queue: HTMLElement[] = [];
1011
protected _active: HTMLElement[] = [];
1112
protected _activeDefer: Function;
1213
protected _clearDefer: Function;
14+
1315
_css: string;
1416
activatedDelay = ADD_ACTIVATED_DEFERS;
1517
clearDelay = CLEAR_STATE_DEFERS;
@@ -19,6 +21,9 @@ export class Activator implements ActivatorBase {
1921
}
2022

2123
clickAction(ev: UIEvent, activatableEle: HTMLElement, startCoord: PointerCoordinates) {
24+
if (isActivatedDisabled(ev, activatableEle)) {
25+
return;
26+
}
2227
// a click happened, so immediately deactive all activated elements
2328
this._scheduleClear();
2429

src/tap-click/tap-click.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { UIEventManager } from '../gestures/ui-event-manager';
1818
*/
1919
@Injectable()
2020
export class TapClick {
21+
2122
private disableClick: number = 0;
2223
private usePolyfill: boolean;
2324
private activator: ActivatorBase;
@@ -236,7 +237,7 @@ function getActivatableTarget(ele: HTMLElement): any {
236237
/**
237238
* @hidden
238239
*/
239-
export const isActivatable = function (ele: HTMLElement) {
240+
export function isActivatable(ele: HTMLElement) {
240241
if (ACTIVATABLE_ELEMENTS.indexOf(ele.tagName) > -1) {
241242
return true;
242243
}

0 commit comments

Comments
 (0)