Skip to content

Commit 990a573

Browse files
committed
fix(tabs): use buttons for paginator
Uses `button` elements, rather than styled `div`-s for the paginator buttons. This has the advantage of being more accessible, if we decided to make them focusable, and it stops calling the click listeners when the button is disabled (currently we do some expensive checks in them when we don't have to).
1 parent a58c725 commit 990a573

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/material/tabs/_tabs-common.scss

+9
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ $mat-tab-animation-duration: 500ms !default;
9595
z-index: 2;
9696
-webkit-tap-highlight-color: transparent;
9797
touch-action: none;
98+
box-sizing: content-box;
99+
background: none;
100+
border: none;
101+
outline: 0;
102+
padding: 0;
103+
104+
&::-moz-focus-inner {
105+
border: 0;
106+
}
98107

99108
.mat-tab-header-pagination-controls-enabled & {
100109
display: flex;
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
<div class="mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4"
1+
<button class="mat-tab-header-pagination mat-tab-header-pagination-before mat-elevation-z4"
22
#previousPaginator
33
aria-hidden="true"
4-
mat-ripple [matRippleDisabled]="_disableScrollBefore || disableRipple"
4+
type="button"
5+
mat-ripple
6+
tabindex="-1"
7+
[matRippleDisabled]="_disableScrollBefore || disableRipple"
58
[class.mat-tab-header-pagination-disabled]="_disableScrollBefore"
9+
[disabled]="_disableScrollBefore || null"
610
(click)="_handlePaginatorClick('before')"
711
(mousedown)="_handlePaginatorPress('before', $event)"
812
(touchend)="_stopInterval()">
913
<div class="mat-tab-header-pagination-chevron"></div>
10-
</div>
14+
</button>
1115

1216
<div class="mat-tab-link-container" #tabListContainer (keydown)="_handleKeydown($event)">
1317
<div class="mat-tab-list" #tabList (cdkObserveContent)="_onContentChanges()">
@@ -18,13 +22,17 @@
1822
</div>
1923
</div>
2024

21-
<div class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
25+
<button class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
2226
#nextPaginator
2327
aria-hidden="true"
24-
mat-ripple [matRippleDisabled]="_disableScrollAfter || disableRipple"
28+
type="button"
29+
mat-ripple
30+
[matRippleDisabled]="_disableScrollAfter || disableRipple"
2531
[class.mat-tab-header-pagination-disabled]="_disableScrollAfter"
32+
[disabled]="_disableScrollAfter || null"
33+
tabindex="-1"
2634
(mousedown)="_handlePaginatorPress('after', $event)"
2735
(click)="_handlePaginatorClick('after')"
2836
(touchend)="_stopInterval()">
2937
<div class="mat-tab-header-pagination-chevron"></div>
30-
</div>
38+
</button>

0 commit comments

Comments
 (0)