-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(tabs): add automatic scrolling when holding down paginator #14632
Conversation
(click)="_scrollHeader('before')"> | ||
(click)="_handlePaginatorClick('before')" | ||
(mousedown)="_handlePaginatorPress('before')" | ||
(touchend)="_stopInterval()"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the mix of mousedown
and touchend
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The touchend
is there to clear the interval in case the mousedown
doesn't fire since it behaves closer to a click on touch devices.
@@ -230,9 +271,25 @@ export class MatTabHeader extends _MatTabHeaderMixinBase | |||
}); | |||
} | |||
|
|||
ngAfterViewInit() { | |||
// We need to handle these events manually, because we want to bind passive event listeners. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd expand the comment like
// Register event handlers for scrolling tabs while holding down the pagination buttons.
// We register these events manually because we want to bind *passive* event listeners.
@@ -469,4 +529,49 @@ export class MatTabHeader extends _MatTabHeaderMixinBase | |||
|
|||
this._inkBar.alignToElement(selectedLabelWrapper!); | |||
} | |||
|
|||
/** Stops the currently-running paginator interval. */ | |||
_stopInterval() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_stopPaginationScrollInterval
?
ff70154
to
9450e37
Compare
I've addressed the feedback @jelbourn. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
9450e37
to
0e795e8
Compare
@crisbeto Looks like the API golden check failed - can you update the API |
Adds some code that automatically keeps scrolling the tab header while holding down one of the paginator buttons. This is useful on long lists of tabs where the user might have to click a lot to reach the tab that they want. Fixes angular#6510.
0e795e8
to
8cf20da
Compare
Updated the goldens. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds some code that automatically keeps scrolling the tab header while holding down one of the paginator buttons. This is useful on long lists of tabs where the user might have to click a lot to reach the tab that they want.
Fixes #6510.