Skip to content

Commit 1f806ea

Browse files
crisbetojosephperrott
authored andcommitted
fix(tabs): paginated header offset incorrect on IE (#13223)
Currently we position the paginated tab header items using a `transform` in order to be able to animate them. On IE setting the transform also ends up changing the scroll position of the parent element, causing the tab offset to be thrown off. These changes reset the scroll after setting the transform. Fixes #13217.
1 parent 8219a67 commit 1f806ea

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lib/tabs/tab-header.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,11 @@ export class MatTabHeader extends _MatTabHeaderMixinBase
324324
// and ripples will exceed the boundaries of the visible tab bar.
325325
// See: https://github.com/angular/material2/issues/10276
326326
this._tabList.nativeElement.style.transform = `translateX(${translateX}px)`;
327+
328+
// Setting the `transform` on IE will change the scroll offset of the parent, causing the
329+
// position to be thrown off in some cases. We have to reset it ourselves to ensure that
330+
// it doesn't get thrown off.
331+
this._tabListContainer.nativeElement.scrollLeft = 0;
327332
}
328333

329334
/** Sets the distance in pixels that the tab header should be transformed in the X-axis. */

0 commit comments

Comments
 (0)