Skip to content

Commit

Permalink
fix(module:tabs): tab-link cannot be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
hsuanxyz committed Sep 10, 2020
1 parent 4cc14ba commit 8a5ce8f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
10 changes: 1 addition & 9 deletions components/button/button.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ const NZ_CONFIG_MODULE_NAME: NzConfigKey = 'button';
'[class.ant-btn-block]': `nzBlock`,
'[class.ant-input-search-button]': `nzSearch`,
'[attr.tabindex]': 'disabled ? -1 : (tabIndex === null ? null : tabIndex)',
'[attr.disabled]': 'disabled || null',
'(click)': 'haltDisabledEvents($event)'
'[attr.disabled]': 'disabled || null'
}
})
export class NzButtonComponent implements OnDestroy, OnChanges, AfterViewInit, AfterContentInit {
Expand All @@ -86,13 +85,6 @@ export class NzButtonComponent implements OnDestroy, OnChanges, AfterViewInit, A
private destroy$ = new Subject<void>();
private loading$ = new Subject<boolean>();

haltDisabledEvents(event: Event): void {
if (this.disabled) {
event.preventDefault();
event.stopImmediatePropagation();
}
}

insertSpan(nodes: NodeList, renderer: Renderer2): void {
nodes.forEach(node => {
if (node.nodeName === '#text') {
Expand Down
12 changes: 12 additions & 0 deletions components/tabs/style/patch.less
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,20 @@ nz-tabs-nav {
color: @disabled-color;
background: transparent;
cursor: not-allowed;

a {
pointer-events: none;
color: @disabled-color;
}
}
}
}
}
}

.@{tab-prefix-cls} {
&-tab-disabled a {
pointer-events: none;
color: @disabled-color;
}
}

0 comments on commit 8a5ce8f

Please sign in to comment.