|
2902 | 2902 | if (attrs.name !== null && (__radio_buttons[attrs.name] === undefined))
|
2903 | 2903 | __radio_buttons[attrs.name] = null
|
2904 | 2904 |
|
2905 |
| - attrs.jradio = $(`<input aria-label="${attrs.aria_label}" type="radio">`).css({width:'16px', height:'16px'}).appendTo(attrs.pos) |
| 2905 | + let aria_label = attrs.aria_label || attrs.text |
| 2906 | + attrs.jradio = $(`<input aria-label="${aria_label}" type="radio">`).css({width:'16px', height:'16px'}).appendTo(attrs.pos) |
2906 | 2907 | .click( function() {
|
2907 | 2908 | if (attrs.name === null) {
|
2908 | 2909 | attrs.checked = !attrs.checked
|
2909 |
| - $(attrs.jradio).prop('checked', attrs.checked) |
| 2910 | + $(attrs.jradio).prop('checked', attrs.checked).attrs('aria-checked', attrs.checked) |
2910 | 2911 | attrs.bind(cradio)
|
2911 | 2912 | } else if (!attrs.checked) {
|
2912 | 2913 | let name = attrs.name
|
|
2915 | 2916 | rb[name] = cradio
|
2916 | 2917 | attrs.checked = true
|
2917 | 2918 | $(attrs.jradio).prop('checked', attrs.checked)
|
| 2919 | + $(attrs.jradio).attr('aria-checked', attrs.checked) |
2918 | 2920 | attrs.bind(cradio)
|
2919 | 2921 | }
|
2920 | 2922 | } )
|
|
2951 | 2953 | }
|
2952 | 2954 | }
|
2953 | 2955 | attrs.checked = value
|
2954 |
| - $(attrs.jradio).prop('checked', value) |
| 2956 | + $(attrs.jradio).prop('checked', value).attr('aria-checked', value) |
2955 | 2957 | },
|
2956 | 2958 | get text() {return attrs.text},
|
2957 | 2959 | set text(value) {
|
|
3013 | 3015 | attrs.disabled = booleanize(attrs.disabled)
|
3014 | 3016 | widgetid++
|
3015 | 3017 | attrs._id = widgetid.toString()
|
3016 |
| - attrs.jcheckbox = $(`<input aria-label="${attrs.aria_label}" type="checkbox"/>`).css({width:'16px', height:'16px'}).appendTo(attrs.pos) |
| 3018 | + let aria_label = attrs.aria_label || attrs.text |
| 3019 | + attrs.jcheckbox = $(`<input aria-checked="${attrs.checked}" aria-label="${aria_label}" type="checkbox"/>`).css({width:'16px', height:'16px'}).appendTo(attrs.pos) |
3017 | 3020 | .click( function() {
|
3018 | 3021 | attrs.checked = !attrs.checked
|
3019 | 3022 | $(attrs.jcheckbox).prop("checked", attrs.checked)
|
| 3023 | + $(attrs.jcheckbox).attr('aria-checked', attrs.checked) |
3020 | 3024 | attrs.bind(ccheckbox)
|
3021 | 3025 | } )
|
3022 | 3026 | $('<span id='+attrs._id+'> '+attrs.text+'</span>').appendTo(attrs.pos)
|
|
3151 | 3155 | widgetid++
|
3152 | 3156 | attrs._id = widgetid.toString()
|
3153 | 3157 | if (attrs.prompt != '') attrs.__wprompt = wtext({text:attrs.prompt+' ', pos:attrs.pos})
|
3154 |
| - attrs.jwinput = $(`<input type="text" id="${attrs._id}" aria-label="${attrs.aria_label}"/>`).val(attrs.text).appendTo(attrs.pos) |
| 3158 | + let aria_label = attrs.aria_label || attrs.text |
| 3159 | + attrs.jwinput = $(`<input type="text" id="${attrs._id}" aria-label="${aria_label}"/>`).val(attrs.text).appendTo(attrs.pos) |
3155 | 3160 | .css({"width":attrs.width.toString()+'px', "height":attrs.height.toString()+'px',
|
3156 | 3161 | "font-size":(attrs.height-5).toString()+"px", "font-family":"sans-serif"})
|
3157 | 3162 | .keypress( function(k) {
|
|
3217 | 3222 | }
|
3218 | 3223 | }
|
3219 | 3224 | attrs.disabled = booleanize(attrs.disabled)
|
3220 |
| - attrs.jbutton = $(`<button aria-label:"${attrs.aria_label}"/>`).html(attrs.text).appendTo(attrs.pos) |
| 3225 | + let aria_label = attrs.aria_label || attrs.text |
| 3226 | + attrs.jbutton = $(`<button aria-label="${aria_label}"/>`).html(attrs.text).appendTo(attrs.pos) |
3221 | 3227 | .css({color:rgb_to_css(attrs.color), backgroundColor:rgb_to_css(attrs.background), "font-size":"15px"})
|
3222 | 3228 | .click( function() { attrs.bind(cbutton) } )
|
3223 | 3229 | attrs.prefix = wtext(' ')
|
|
3235 | 3241 | get text() {return attrs.text},
|
3236 | 3242 | set text(value) {
|
3237 | 3243 | attrs.text = value
|
3238 |
| - $(attrs.jbutton).html(attrs.text) |
| 3244 | + $(attrs.jbutton).html(attrs.text).attr('aria-label', value) |
3239 | 3245 | },
|
3240 | 3246 | get textcolor() {return attrs.color}, // legacy name; no apparent reason why it was "textcolor" instead of "color"
|
3241 | 3247 | set textcolor(value) {
|
|
3342 | 3348 | // otherwise the slider value has been changed by program, in which case
|
3343 | 3349 | // we do NOT call the bound function, as it makes it difficult to manage
|
3344 | 3350 | // multiple sliders that interact, as in the RGB-HSV demo program.
|
3345 |
| - |
3346 |
| - $(`<span aria-label="${attrs.aria_label}" id="${attrs._id}"></span>`).css({float:attrs.align, |
| 3351 | + |
| 3352 | + $(`<span aria-role="slider" aria-label="${attrs.aria_label}" aria-valuemin="${attrs.min}" |
| 3353 | + aria-valuemax="${attrs.max}" id="${attrs._id}"></span>`).css({float:attrs.align, |
3347 | 3354 | width:w, height:h, margin:m, display:"inline-block"}).appendTo(attrs.pos)
|
3348 | 3355 | attrs.jslider = $( '#'+attrs._id ).slider({orientation:o, range:"min",
|
3349 | 3356 | min:attrs.min, max:attrs.max, value:attrs.value, step:attrs.step,
|
|
0 commit comments