Closed
Description
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
probably never worked
Description
The scroll position of a mat-tab-nav-bar is not clamped to the max scroll distance when tabs are removed, but is still scrollable.
Reproduction
Steps to reproduce:
- Open Stackblitz: https://stackblitz.com/edit/components-issue-s5jn1k?file=src/app/example-component.ts
- Scroll all the way to the end of the tab nav
- Click on the button to remove the first 2 tabs
- Tabs scroll out of view, because scroll position is not reset to _getMaxScrollDistance
Related: Clicking on the button again to remove another 2 tabs scrolls the content back into view, because now the nav bar is no longer scrollable (this was fixed by #23759)
Expected Behavior
Scroll position is never greater than maximum scroll distance
Actual Behavior
Scroll position remains the same, tabs are scrolled out of view
Environment
- Angular: 13.1.1
- CDK/Material: 13.1.1
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10