1 From 15c488ed418fa5c8b5ae562427682f3a4e3bed8c Mon Sep 17 00:00:00 2001
2 From: "sang-hee.lee" <sang-hee.lee@samsung.com>
3 Date: Tue, 19 Mar 2013 20:05:24 +0900
4 Subject: [PATCH] JQM Support accessibility for checkboxradio
7 .../js/widgets/forms/checkboxradio.js | 12 ++++++++++--
8 1 file changed, 10 insertions(+), 2 deletions(-)
10 diff --git a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js
11 index a9f8f31..aa6f8a2 100644
12 --- a/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js
13 +++ b/libs/js/jquery-mobile-1.2.0/js/widgets/forms/checkboxradio.js
14 @@ -38,12 +38,15 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
15 checkedClass = "ui-" + checkedState + activeBtn,
16 uncheckedClass = "ui-" + uncheckedState,
17 checkedicon = "ui-icon-" + checkedState,
18 - uncheckedicon = "ui-icon-" + uncheckedState;
19 + uncheckedicon = "ui-icon-" + uncheckedState,
20 + ariaCheckedAttr = "";
22 if ( inputtype !== "checkbox" && inputtype !== "radio" ) {
26 + ariaCheckedAttr = ( inputtype === "checkbox" ) ? "aria-checked" : "aria-selected";
29 if ( label.length == 0 ) {
30 label = $( "<label for='" + input[ 0 ].id +
31 @@ -57,7 +60,8 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
32 checkedClass: checkedClass,
33 uncheckedClass: uncheckedClass,
34 checkedicon: checkedicon,
35 - uncheckedicon: uncheckedicon
36 + uncheckedicon: uncheckedicon,
37 + ariaCheckedAttr : ariaCheckedAttr
40 // If there's no selected theme check the data attr
41 @@ -76,6 +80,7 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
42 // Wrap the input + label in a div
43 var wrapper = document.createElement('div');
44 wrapper.className = 'ui-' + inputtype;
45 + wrapper.setAttribute( "role", inputtype );
47 if ( input.hasClass( "favorite" ) ) {
48 wrapper.className += ' favorite';
49 @@ -184,14 +189,17 @@ $.widget( "mobile.checkboxradio", $.mobile.widget, {
51 var input = this.element[0],
53 + wrapper = input.parentNode,
54 icon = label.find( ".ui-icon" );
56 if ( input.checked ) {
57 label.addClass( this.checkedClass ).removeClass( this.uncheckedClass );
58 icon.addClass( this.checkedicon ).removeClass( this.uncheckedicon );
59 + wrapper.setAttribute( this.ariaCheckedAttr, true );
61 label.removeClass( this.checkedClass ).addClass( this.uncheckedClass );
62 icon.removeClass( this.checkedicon ).addClass( this.uncheckedicon );
63 + wrapper.setAttribute( this.ariaCheckedAttr, false );
66 if ( input.disabled ) {