Popup: reverse orientation bug has been fixed
[platform/framework/web/web-ui-fw.git] / libs / patch / 0038-JQM-Support-accessibility-for-listview.patch
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
5
6 ---
7  libs/js/jquery-mobile-1.2.0/js/widgets/listview.js |   27 +++++++++++++++++---
8  1 file changed, 24 insertions(+), 3 deletions(-)
9
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" ) );
17                         if ( img.length ) {
18 -                               img.addClass( "ui-li-thumb" );
19 +                               img.addClass( "ui-li-thumb" ).attr( {
20 +                                       "role" : "",
21 +                                       "aria-label" : "icon"
22 +                               });
23                                 $( this._findFirstElementByTagName( img[ 0 ].parentNode, "parentNode", "li", "LI" ) ).addClass( img.is( ".ui-li-icon" ) ? "ui-li-has-icon" : "ui-li-has-thumb" );
24                         }
25                 }
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( {
32 +                                       "role": "",
33 +                                       "tabindex": "0"
34 +                               });
35                                 var isDivider = ( $.mobile.getAttrFixed( item[0], "data-" + $.mobile.ns + "role" ) === "list-divider" );
36  
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" );
43 +                                               }
44 +
45 +                                               if ( checkboxradio.length ) {
46 +                                                       checkboxradio.children( "label" ).trigger( "vclick" );
47 +                                               }
48 +                                       });
49 +                               }
50 +
51                                 if ( a.length && !isDivider ) {
52                                         icon = $.mobile.getAttrFixed( item[0], "data-" + $.mobile.ns + "icon" );
53  
54 @@ -287,7 +307,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
55                                 } else if ( isDivider ) {
56  
57                                         itemClass += " ui-li-divider ui-bar-" + dividertheme;
58 -                                       item.attr( "role", "heading" );
59 +                                       item.attr( { "role": "heading", "tabindex": "0" } );
60  
61                                         if ( ol ) {     
62                                                 //reset counter when a divider heading is encountered
63 @@ -305,6 +325,7 @@ $.widget( "mobile.listview", $.mobile.widget, {
64                                 
65                                 } else {
66                                         itemClass += " ui-li-static ui-btn-up-" + itemTheme;
67 +                                       item.attr( "tabindex", "0" );
68                                 }
69                         }
70  
71 -- 
72 1.7.9.5
73