@@ -63,6 +63,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
63
63
ctrl . getTabElementIndex = getTabElementIndex ;
64
64
ctrl . updateInkBarStyles = $mdUtil . debounce ( updateInkBarStyles , 100 ) ;
65
65
ctrl . updateTabOrder = $mdUtil . debounce ( updateTabOrder , 100 ) ;
66
+ ctrl . getFocusedTabId = getFocusedTabId ;
66
67
67
68
init ( ) ;
68
69
@@ -339,7 +340,7 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
339
340
ctrl . offsetLeft = fixOffset ( tab . offsetLeft ) ;
340
341
} else {
341
342
/**
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
343
344
* pagination "for loop" to proceed correctly on next tab when nextPage() is called again
344
345
*/
345
346
ctrl . offsetLeft = fixOffset ( tab . offsetLeft + ( tab . offsetWidth - viewportWidth + 1 ) ) ;
@@ -362,10 +363,10 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
362
363
ctrl . offsetLeft = fixOffset ( tab . offsetLeft + tab . offsetWidth - elements . canvas . clientWidth ) ;
363
364
} else {
364
365
/**
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
366
367
* pagination "for loop" to break correctly on previous tab when previousPage() is called again
367
368
*/
368
- ctrl . offsetLeft = fixOffset ( tab . offsetLeft ) ;
369
+ ctrl . offsetLeft = fixOffset ( tab . offsetLeft ) ;
369
370
}
370
371
}
371
372
@@ -494,6 +495,17 @@ function MdTabsController ($scope, $element, $window, $mdConstant, $mdTabInkRipp
494
495
ctrl . offsetLeft ;
495
496
}
496
497
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
+
497
509
/**
498
510
* Determines if the UI should stretch the tabs to fill the available space.
499
511
* @returns {* }
0 commit comments