accessibility - How can I add JAWS-compatible HTML form labels to month and day dropdowns in jQuery UI 1.10.4 datepicker -


we using jquery 1.10.4 datepicker month , year dropdowns. unfortunately, these dropdowns not have html labels attached, need screenreader requirements. have been trying find workaround not involve editing jquery code directly (which take 2 minutes) don't forget next time upgrade our jquery version. lack of labels accessibility (a11y) issue, essential our site.

the html field looks this:

<label for="dateofbirth">birth date (mm/dd/yyyy) </label>  <input type="text" id="dateofbirth" name="dateofbirth" value="" class="datepick form-control form-text required hasdatepicker"> 

the setup datepicker looks this:

function setupcalendarmonthyearlabels() {     if ($("select.ui-datepicker-month").attr('id') !=  'ui-datepicker-month-select') {         $("select.ui-datepicker-month").attr('id', 'ui-datepicker-month-select');     }     if ($("select.ui-datepicker-month").attr('id') !=  'ui-datepicker-month-select') {         $("select.ui-datepicker-month").attr('id', 'ui-datepicker-month-select');     }     if ($("#ui-datepicker-month-select-label").length==0) {         $("<label for='ui-datepicker-month-select' id='ui-datepicker-month-select-label'>select month</label>").insertbefore("select.ui-datepicker-month");     }     if ($("#ui-datepicker-year-select-label").length==0) {         $("<label for='ui-datepicker-year-select' id='ui-datepicker-year-select-label'>select year</label>").insertbefore("select.ui-datepicker-year");      } }  $(function() {     $( ".datepick" ).datepicker({changemonth: true, changeyear: true,yearrange : '-80:+10'});     $( ".datepick" ).focus(setupcalendarmonthyearlabels);     $( ".datepick" ).click(setupcalendarmonthyearlabels);     $( "body" ).on("focusin click change", "#ui-datepicker-div select", setupcalendarmonthyearlabels); }); 

i can see labels right now, , ugly, i'm not concerned about jaws recognizing them. reads them when first open datepicker, on subsequent opens, reads label dateofbirth field, not dropdowns. additionally, can see labels added in developer tools, jaws isn't reading them.

if unfamiliar jaws, might me know how attach event datepicker gets fired right before gets rendered. wondering if familiar jquery ui know. more of back-end developer , jquery internals unfamiliar me.

jquery needs event delegation attach elements jaws persistently recognise them. way doesn't matter if add more stuff later on or take away, knows take fresh each time.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -