@@ -63,6 +63,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
6363 ctrl . getTabElementIndex = getTabElementIndex ;
6464 ctrl . updateInkBarStyles = $mdUtil . debounce ( updateInkBarStyles , 100 ) ;
6565 ctrl . updateTabOrder = $mdUtil . debounce ( updateTabOrder , 100 ) ;
66+ ctrl . getFocusedTabId = getFocusedTabId ;
6667
6768 init ( ) ;
6869
@@ -339,7 +340,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
339340 ctrl . offsetLeft = fixOffset ( tab . offsetLeft ) ;
340341 } else {
341342 /**
342- * Canvas width *smaller* than tab width: positioning at the *end* of current tab to let
343+ * Canvas width *smaller* than tab width: positioning at the *end* of current tab to let
343344 * pagination "for loop" to proceed correctly on next tab when nextPage() is called again
344345 */
345346 ctrl . offsetLeft = fixOffset ( tab . offsetLeft + ( tab . offsetWidth - viewportWidth + 1 ) ) ;
@@ -362,10 +363,10 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
362363 ctrl . offsetLeft = fixOffset ( tab . offsetLeft + tab . offsetWidth - elements . canvas . clientWidth ) ;
363364 } else {
364365 /**
365- * Canvas width *smaller* than tab width: positioning at the *beginning* of current tab to let
366+ * Canvas width *smaller* than tab width: positioning at the *beginning* of current tab to let
366367 * pagination "for loop" to break correctly on previous tab when previousPage() is called again
367368 */
368- ctrl . offsetLeft = fixOffset ( tab . offsetLeft ) ;
369+ ctrl . offsetLeft = fixOffset ( tab . offsetLeft ) ;
369370 }
370371 }
371372
@@ -494,6 +495,17 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
494495 ctrl . offsetLeft ;
495496 }
496497
498+ /**
499+ * Returns currently focused tab item's element ID
500+ */
501+ function getFocusedTabId ( ) {
502+ var focusedTab = ctrl . tabs [ ctrl . focusIndex ] ;
503+ if ( ! focusedTab || ! focusedTab . id ) {
504+ return null ;
505+ }
506+ return 'tab-item-' + focusedTab . id ;
507+ }
508+
497509 /**
498510 * Determines if the UI should stretch the tabs to fill the available space.
499511 * @returns {* }
0 commit comments