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

Commit ab910d3

Browse files
author
Gabriel Schulhof
committed
Links: Append popup accessibility attributes. Fixes #5898.
1 parent 7696e9f commit ab910d3

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

js/jquery.mobile.links.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ $.mobile._enhancer.add( "mobile.links", undefined, function( target ) {
1414
$( target )
1515
.find( "a" )
1616
.jqmEnhanceable()
17+
.filter( ":jqmData(rel='popup')[href][href!='']" )
18+
.each( function() {
19+
// Accessibility info for popups
20+
var e = this,
21+
href = $( this ).attr( "href" );
22+
23+
e.setAttribute( "aria-haspopup", true );
24+
e.setAttribute( "aria-owns", href );
25+
e.setAttribute( "aria-expanded", false );
26+
$( document )
27+
.on( "popupafteropen", href, function() {
28+
e.setAttribute( "aria-expanded", true );
29+
})
30+
.on( "popupafterclose", href, function() {
31+
e.setAttribute( "aria-expanded", false );
32+
});
33+
})
34+
.end()
1735
.not( ".ui-btn, .ui-link-inherit, :jqmData(role='none'), :jqmData(role='nojs')" )
1836
.addClass( "ui-link" );
1937

0 commit comments

Comments
 (0)