Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Links: Append popup accessibility attributes. Fixes #5898.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Schulhof committed Apr 18, 2013
1 parent 7696e9f commit ab910d3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions js/jquery.mobile.links.js
Expand Up @@ -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 );

This comment has been minimized.

Copy link
@nschonni

nschonni Jul 23, 2013

Contributor

http://www.w3.org/TR/wai-aria/states_and_properties#aria-owns must be used only once for an element. This would be a failure if a anchor link is used more than once on a page

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" );

Expand Down

0 comments on commit ab910d3

Please sign in to comment.