1 From 2f68f0cd4b3e55d0e9cc08cb3e9b4b00a45c3674 Mon Sep 17 00:00:00 2001
2 From: "sang-hee.lee" <sang-hee.lee@samsung.com>
3 Date: Tue, 19 Mar 2013 21:58:18 +0900
4 Subject: [PATCH] JQM Support accessibility for listview
7 libs/js/jquery-mobile-1.2.0/js/widgets/listview.js | 27 +++++++++++++++++---
8 1 file changed, 24 insertions(+), 3 deletions(-)
10 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js
11 index 993d03e..4d53d2c 100644
12 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js
13 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/listview.js
14 @@ -147,7 +147,10 @@ $.widget( "mobile.listview", $.mobile.widget, {
15 for ( i = 0; i < len; i++ ) {
16 img = $( this._findFirstElementByTagName( containers[ i ].firstChild, "nextSibling", "img", "IMG" ) );
18 - img.addClass( "ui-li-thumb" );
19 + img.addClass( "ui-li-thumb" ).attr( {
21 + "aria-label" : "icon"
23 $( this._findFirstElementByTagName( img[ 0 ].parentNode, "parentNode", "li", "LI" ) ).addClass( img.is( ".ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" );
26 @@ -228,9 +231,26 @@ $.widget( "mobile.listview", $.mobile.widget, {
27 // If we're creating the element, we update it regardless
28 if ( create || !item.hasClass( "ui-li" ) ) {
29 itemTheme = $.mobile.getAttrFixed( item[0], "data-" + $.mobile.ns + "theme" ) || o.theme;
30 - a = this._getChildrenByTagName( item[ 0 ], "a", "A" );
31 + a = this._getChildrenByTagName( item[ 0 ], "a", "A" ).attr( {
35 var isDivider = ( $.mobile.getAttrFixed( item[0], "data-" + $.mobile.ns + "role" ) === "list-divider" );
37 + if ( item.hasClass( "ui-li-has-checkbox" ) || item.hasClass( "ui-li-has-radio" ) ) {
38 + item.on( "vclick", function ( e ) {
39 + var targetItem = $( e.target );
40 + var checkboxradio = targetItem.find( ".ui-checkbox" );
41 + if ( !checkboxradio.length ) {
42 + checkboxradio = targetItem.find( ".ui-radio" );
45 + if ( checkboxradio.length ) {
46 + checkboxradio.children( "label" ).trigger( "vclick" );
51 if ( a.length && !isDivider ) {
52 icon = $.mobile.getAttrFixed( item[0], "data-" + $.mobile.ns + "icon" );
54 @@ -287,7 +307,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
55 } else if ( isDivider ) {
57 itemClass += " ui-li-divider ui-bar-" + dividertheme;
58 - item.attr( "role", "heading" );
59 + item.attr( { "role": "heading", "tabindex": "0" } );
62 //reset counter when a divider heading is encountered
63 @@ -305,6 +325,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
66 itemClass += " ui-li-static ui-btn-up-" + itemTheme;
67 + item.attr( "tabindex", "0" );