-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(tabs): disable without using pointer-events
#7364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/lib/tabs/_tabs-common.scss
Outdated
@@ -24,7 +24,10 @@ $mat-tab-animation-duration: 500ms !default; | |||
|
|||
&.mat-tab-disabled { | |||
cursor: default; | |||
pointer-events: none; | |||
|
|||
&:focus { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fading out the element only on focus seems a little weird. Wouldn't it be better if we prevented focus in the first place? That's what the pointer-events
approach was doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By disabling pointer-events
entirely things like tooltips are prevented from being attached to a <mat-tab-label>
src/lib/tabs/tab-group.html
Outdated
[matRippleDisabled]="disableRipple" | ||
(click)="tabHeader.focusIndex = selectedIndex = i"> | ||
[matRippleDisabled]="tab.disabled || disableRipple" | ||
(click)="!tab.disabled && tabHeader.focusIndex = selectedIndex = i"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This expression looks a bit weird. Considering moving it into a function?
cc514b1
to
0004de3
Compare
@crisbeto Whenever you have a change, please take another look. I realized that the issue we were running into was that we were adding |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
src/lib/tabs/tab-group.ts
Outdated
if (!tab.disabled) { | ||
tabHeader.focusIndex = idx; | ||
this.selectedIndex = idx; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optionally this could be reduced to: this.selectedIndex = tabHeader.focusIndex = idx
.
@josephperrott Check out CI failures? |
cc4a99f
to
6607796
Compare
6607796
to
aa4d14e
Compare
@kara CI failures are fixed. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes #6755