Skip to content

Commit 1bf7543

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 d22f48c commit 1bf7543

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/lib/tabs/tab-header.html

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
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
aria-hidden="true"
3-
mat-ripple [matRippleDisabled]="_disableScrollBefore || disableRipple"
3+
type="button"
4+
mat-ripple
5+
[matRippleDisabled]="_disableScrollBefore || disableRipple"
46
[class.mat-tab-header-pagination-disabled]="_disableScrollBefore"
7+
[disabled]="_disableScrollBefore || null"
8+
tabindex="-1"
59
(click)="_scrollHeader('before')">
610
<div class="mat-tab-header-pagination-chevron"></div>
7-
</div>
11+
</button>
812

913
<div class="mat-tab-label-container" #tabListContainer
1014
(keydown)="_handleKeydown($event)">
@@ -16,10 +20,14 @@
1620
</div>
1721
</div>
1822

19-
<div class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
23+
<button class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
2024
aria-hidden="true"
21-
mat-ripple [matRippleDisabled]="_disableScrollAfter || disableRipple"
25+
type="button"
26+
mat-ripple
27+
[matRippleDisabled]="_disableScrollAfter || disableRipple"
2228
[class.mat-tab-header-pagination-disabled]="_disableScrollAfter"
29+
[disabled]="_disableScrollAfter || null"
30+
tabindex="-1"
2331
(click)="_scrollHeader('after')">
2432
<div class="mat-tab-header-pagination-chevron"></div>
25-
</div>
33+
</button>

src/lib/tabs/tab-header.scss

+9
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,15 @@
3232
min-width: 32px;
3333
cursor: pointer;
3434
z-index: 2;
35+
box-sizing: content-box;
36+
background: none;
37+
border: none;
38+
outline: 0;
39+
padding: 0;
40+
41+
&::-moz-focus-inner {
42+
border: 0;
43+
}
3544

3645
.mat-tab-header-pagination-controls-enabled & {
3746
display: flex;

0 commit comments

Comments
 (0)