File tree Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Expand file tree Collapse file tree 3 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -743,7 +743,7 @@ class SimpleTabHeaderApp {
743
743
focusedIndex : number ;
744
744
disablePagination : boolean ;
745
745
disabledTabIndex = 1 ;
746
- tabs : Tab [ ] = [ { label : 'tab one' } , { label : 'tab one ' } , { label : 'tab one ' } , { label : 'tab one ' } ] ;
746
+ tabs : Tab [ ] = [ { label : 'tab one' } , { label : 'tab two ' } , { label : 'tab three ' } , { label : 'tab four ' } ] ;
747
747
dir : Direction = 'ltr' ;
748
748
749
749
@ViewChild ( MatLegacyTabHeader , { static : true } ) tabHeader : MatLegacyTabHeader ;
Original file line number Diff line number Diff line change @@ -57,12 +57,6 @@ const passiveEventListenerOptions = normalizePassiveListenerOptions({
57
57
*/
58
58
export type ScrollDirection = 'after' | 'before' ;
59
59
60
- /**
61
- * The distance in pixels that will be overshot when scrolling a tab label into view. This helps
62
- * provide a small affordance to the label next to it.
63
- */
64
- const EXAGGERATED_OVERSCROLL = 60 ;
65
-
66
60
/**
67
61
* Amount of milliseconds to wait before starting to scroll the header automatically.
68
62
* Set a little conservatively in order to handle fake events dispatched on touch devices.
@@ -524,10 +518,13 @@ export abstract class MatPaginatedTabHeader
524
518
525
519
if ( labelBeforePos < beforeVisiblePos ) {
526
520
// Scroll header to move label to the before direction
527
- this . scrollDistance -= beforeVisiblePos - labelBeforePos + EXAGGERATED_OVERSCROLL ;
521
+ this . scrollDistance -= beforeVisiblePos - labelBeforePos ;
528
522
} else if ( labelAfterPos > afterVisiblePos ) {
529
523
// Scroll header to move label to the after direction
530
- this . scrollDistance += labelAfterPos - afterVisiblePos + EXAGGERATED_OVERSCROLL ;
524
+ this . scrollDistance += Math . min (
525
+ labelAfterPos - afterVisiblePos ,
526
+ labelBeforePos - beforeVisiblePos ,
527
+ ) ;
531
528
}
532
529
}
533
530
Original file line number Diff line number Diff line change @@ -742,7 +742,7 @@ class SimpleTabHeaderApp {
742
742
selectedIndex : number = 0 ;
743
743
focusedIndex : number ;
744
744
disabledTabIndex = 1 ;
745
- tabs : Tab [ ] = [ { label : 'tab one' } , { label : 'tab one ' } , { label : 'tab one ' } , { label : 'tab one ' } ] ;
745
+ tabs : Tab [ ] = [ { label : 'tab one' } , { label : 'tab two ' } , { label : 'tab three ' } , { label : 'tab four ' } ] ;
746
746
dir : Direction = 'ltr' ;
747
747
disablePagination : boolean ;
748
748
You can’t perform that action at this time.
0 commit comments