Skip to content

Commit a634505

Browse files
crisbetoandrewseguin
authored andcommitted
fix(material/tabs): use buttons for paginator (#14640)
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). (cherry picked from commit e8919bc)
1 parent 8bd529b commit a634505

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 @@ $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;

src/material/tabs/tab-nav-bar/tab-nav-bar.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', $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
@@ -22,13 +26,17 @@
2226
</div>
2327
</div>
2428

25-
<div class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
29+
<button class="mat-tab-header-pagination mat-tab-header-pagination-after mat-elevation-z4"
2630
#nextPaginator
2731
aria-hidden="true"
28-
mat-ripple [matRippleDisabled]="_disableScrollAfter || disableRipple"
32+
type="button"
33+
mat-ripple
34+
[matRippleDisabled]="_disableScrollAfter || disableRipple"
2935
[class.mat-tab-header-pagination-disabled]="_disableScrollAfter"
36+
[disabled]="_disableScrollAfter || null"
37+
tabindex="-1"
3038
(mousedown)="_handlePaginatorPress('after', $event)"
3139
(click)="_handlePaginatorClick('after')"
3240
(touchend)="_stopInterval()">
3341
<div class="mat-tab-header-pagination-chevron"></div>
34-
</div>
42+
</button>

0 commit comments

Comments
 (0)