Skip to content

Commit f0a57be

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 e661317 commit f0a57be

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,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')"
812
(touchend)="_stopInterval()">
913
<div class="mat-tab-header-pagination-chevron"></div>
10-
</div>
14+
</button>
1115

1216
<div class="mat-tab-label-container" #tabListContainer
1317
(keydown)="_handleKeydown($event)">
@@ -19,13 +23,17 @@
1923
</div>
2024
</div>
2125

22-
<div class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
26+
<button class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
2327
#nextPaginator
2428
aria-hidden="true"
25-
mat-ripple [matRippleDisabled]="_disableScrollAfter || disableRipple"
29+
type="button"
30+
mat-ripple
31+
[matRippleDisabled]="_disableScrollAfter || disableRipple"
2632
[class.mat-tab-header-pagination-disabled]="_disableScrollAfter"
33+
[disabled]="_disableScrollAfter || null"
34+
tabindex="-1"
2735
(mousedown)="_handlePaginatorPress('after')"
2836
(click)="_handlePaginatorClick('after')"
2937
(touchend)="_stopInterval()">
3038
<div class="mat-tab-header-pagination-chevron"></div>
31-
</div>
39+
</button>

src/lib/tabs/tab-header.scss

+9
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
z-index: 2;
3737
-webkit-tap-highlight-color: transparent;
3838
touch-action: none;
39+
box-sizing: content-box;
40+
background: none;
41+
border: none;
42+
outline: 0;
43+
padding: 0;
44+
45+
&::-moz-focus-inner {
46+
border: 0;
47+
}
3948

4049
.mat-tab-header-pagination-controls-enabled & {
4150
display: flex;

0 commit comments

Comments
 (0)