Skip to content

Commit 2082052

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 f9ebb26 commit 2082052

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/material/tabs/_tabs-common.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,15 @@ $mat-tab-animation-duration: 500ms !default;
9393
z-index: 2;
9494
-webkit-tap-highlight-color: transparent;
9595
touch-action: none;
96+
box-sizing: content-box;
97+
background: none;
98+
border: none;
99+
outline: 0;
100+
padding: 0;
101+
102+
&::-moz-focus-inner {
103+
border: 0;
104+
}
96105

97106
.mat-tab-header-pagination-controls-enabled & {
98107
display: flex;
Lines changed: 14 additions & 6 deletions
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-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')"
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)