* Sets focus on the HTML element for the label wrapper and scrolls it into the view if * scrolling is enabled.
(tabIndex: number)
| 418 | * scrolling is enabled. |
| 419 | */ |
| 420 | _setTabFocus(tabIndex: number) { |
| 421 | if (this._showPaginationControls) { |
| 422 | this._scrollToLabel(tabIndex); |
| 423 | } |
| 424 | |
| 425 | if (this._items && this._items.length) { |
| 426 | this._items.toArray()[tabIndex].focus(); |
| 427 | |
| 428 | // Do not let the browser manage scrolling to focus the element, this will be handled |
| 429 | // by using translation. In LTR, the scroll left should be 0. In RTL, the scroll width |
| 430 | // should be the full width minus the offset width. |
| 431 | const containerEl = this._tabListContainer.nativeElement; |
| 432 | const dir = this._getLayoutDirection(); |
| 433 | |
| 434 | if (dir == 'ltr') { |
| 435 | containerEl.scrollLeft = 0; |
| 436 | } else { |
| 437 | containerEl.scrollLeft = containerEl.scrollWidth - containerEl.offsetWidth; |
| 438 | } |
| 439 | } |
| 440 | } |
| 441 | |
| 442 | /** The layout direction of the containing app. */ |
| 443 | _getLayoutDirection(): Direction { |
nothing calls this directly
no test coverage detected