@@ -322,21 +322,22 @@ $.widget( "ui.tabs", {
322
322
323
323
this . panels = $ ( ) ;
324
324
325
- this . anchors . each ( function ( i , a ) {
326
- var selector , panel , id ,
327
- tab = $ ( a ) . closest ( "li" ) ;
325
+ this . anchors . each ( function ( i , anchor ) {
326
+ var selector , panel , panelId ,
327
+ anchorId = $ ( anchor ) . uniqueId ( ) . attr ( "id" ) ,
328
+ tab = $ ( anchor ) . closest ( "li" ) ;
328
329
329
330
// inline tab
330
- if ( isLocal ( a ) ) {
331
- selector = a . hash ;
331
+ if ( isLocal ( anchor ) ) {
332
+ selector = anchor . hash ;
332
333
panel = that . element . find ( that . _sanitizeSelector ( selector ) ) ;
333
334
// remote tab
334
335
} else {
335
- id = that . _tabId ( tab ) ;
336
- selector = "#" + id ;
336
+ panelId = that . _tabId ( tab ) ;
337
+ selector = "#" + panelId ;
337
338
panel = that . element . find ( selector ) ;
338
339
if ( ! panel . length ) {
339
- panel = that . _createPanel ( id ) ;
340
+ panel = that . _createPanel ( panelId ) ;
340
341
panel . insertAfter ( that . panels [ i - 1 ] || that . list ) ;
341
342
}
342
343
panel . attr ( "aria-live" , "polite" ) ;
@@ -347,7 +348,11 @@ $.widget( "ui.tabs", {
347
348
}
348
349
tab
349
350
. data ( "ui-tabs-aria-controls" , tab . attr ( "aria-controls" ) )
350
- . attr ( "aria-controls" , selector . substring ( 1 ) ) ;
351
+ . attr ( {
352
+ "aria-controls" : selector . substring ( 1 ) ,
353
+ "aria-labelledby" : anchorId
354
+ } ) ;
355
+ panel . attr ( "aria-labelledby" , anchorId ) ;
351
356
} ) ;
352
357
353
358
this . panels
@@ -378,8 +383,15 @@ $.widget( "ui.tabs", {
378
383
379
384
// disable tabs
380
385
for ( var i = 0 , li ; ( li = this . lis [ i ] ) ; i ++ ) {
381
- $ ( li ) . toggleClass ( "ui-state-disabled" ,
382
- ( disabled === true || $ . inArray ( i , disabled ) !== - 1 ) ) ;
386
+ if ( disabled === true || $ . inArray ( i , disabled ) !== - 1 ) {
387
+ $ ( li )
388
+ . addClass ( "ui-state-disabled" )
389
+ . attr ( "aria-disabled" , "true" ) ;
390
+ } else {
391
+ $ ( li )
392
+ . removeClass ( "ui-state-disabled" )
393
+ . removeAttr ( "aria-disabled" ) ;
394
+ }
383
395
}
384
396
385
397
this . options . disabled = disabled ;
@@ -613,7 +625,8 @@ $.widget( "ui.tabs", {
613
625
. removeAttr ( "tabIndex" )
614
626
. unbind ( ".tabs" )
615
627
. removeData ( "href.tabs" )
616
- . removeData ( "load.tabs" ) ;
628
+ . removeData ( "load.tabs" )
629
+ . removeUniqueId ( ) ;
617
630
618
631
this . lis . unbind ( ".tabs" ) . add ( this . panels ) . each ( function ( ) {
619
632
if ( $ . data ( this , "ui-tabs-destroy" ) ) {
@@ -632,7 +645,12 @@ $.widget( "ui.tabs", {
632
645
] . join ( " " ) )
633
646
. removeAttr ( "tabIndex" )
634
647
. removeAttr ( "aria-live" )
635
- . removeAttr ( "aria-busy" ) ;
648
+ . removeAttr ( "aria-busy" )
649
+ . removeAttr ( "aria-selected" )
650
+ . removeAttr ( "aria-labelledby" )
651
+ . removeAttr ( "aria-hidden" )
652
+ . removeAttr ( "aria-expanded" )
653
+ . removeAttr ( "role" ) ;
636
654
}
637
655
} ) ;
638
656
0 commit comments