Permalink
Browse files

Links: Append popup accessibility attributes. Fixes #5898.

(cherry picked from commit ab910d3)
  • Loading branch information...
1 parent 089fecb commit 252634e6a1f805ccb44e93b41bcc955aae8309d9 @gabrielschulhof gabrielschulhof committed Apr 18, 2013
Showing with 18 additions and 0 deletions.
  1. +18 −0 js/jquery.mobile.links.js
View
18 js/jquery.mobile.links.js
@@ -14,6 +14,24 @@ $( document ).bind( "pagecreate create", function( e ) {
$( e.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" );

0 comments on commit 252634e

Please sign in to comment.