diff --git a/js/jquery.mobile.links.js b/js/jquery.mobile.links.js index d5b8e9a54c4..95b1554179f 100644 --- a/js/jquery.mobile.links.js +++ b/js/jquery.mobile.links.js @@ -14,6 +14,24 @@ $.mobile._enhancer.add( "mobile.links", undefined, function( target ) { $( target ) .find( "a" ) .jqmEnhanceable() + .filter( ":jqmData(rel='popup')[href][href!='']" ) + .each( function() { + // Accessibility info for popups + var e = this, + href = $( this ).attr( "href" ); + + e.setAttribute( "aria-haspopup", true ); + e.setAttribute( "aria-owns", href ); + e.setAttribute( "aria-expanded", false ); + $( document ) + .on( "popupafteropen", href, function() { + e.setAttribute( "aria-expanded", true ); + }) + .on( "popupafterclose", href, function() { + e.setAttribute( "aria-expanded", false ); + }); + }) + .end() .not( ".ui-btn, .ui-link-inherit, :jqmData(role='none'), :jqmData(role='nojs')" ) .addClass( "ui-link" );