Screen Reader Accessibility
-
In the spirit of making your plugin “accessible to more people around the globe,” I have modified your javascript file
faq-concertina-script.js
a little in order to make it work with screen readers. Perhaps you’d consider adopting this version (or something similar) in a future update. Here’s the modified file:jQuery(document).ready(function(){ // Make FAQs screen-readable jQuery('.faq_q').attr('tabindex','0').each(function() { var ans = jQuery(this).next('.faq_a'); var ansID = jQuery(ans).attr('id'); jQuery(this).attr('aria-controls', ansID).attr('aria-expanded','false'); jQuery(ans).attr('tabindex','0').attr('aria-hidden','true'); }); // Toggle Function jQuery('.faq_item').on('click keyup', function(e){ if (e.type == "click" || e.keyCode == 13) { var speed = parseInt( faqconcvars.speed, 10 ); // get the speed which answers should open and close if ( parseInt( faqconcvars.hideothers, 10) ) { // if hideothers set, i.e. only one answer can be open at a time if ( jQuery('#'+jQuery(this).attr("id")+'_q').hasClass("faq_is_open") ) { // if this answer is already open jQuery('#'+jQuery(this).attr("id")+'_a').slideUp(speed).attr('aria-hidden','true'); // hide this answer jQuery('#'+jQuery(this).attr("id")+'_q').removeClass("faq_is_open").attr('aria-expanded','false'); // set show/hide indicator to 'show' on this question } else { // if this answer is currently closed jQuery('.faq_a').slideUp(speed).attr('aria-hidden','true'); // hide all answers jQuery('.faq_q').removeClass("faq_is_open").attr('aria-expanded','false'); // set show/hide indicators to 'show' on all questions jQuery('#'+jQuery(this).attr("id")+'_a').slideDown(speed).attr('aria-hidden','false'); // show this answer jQuery('#'+jQuery(this).attr("id")+'_q').addClass("faq_is_open").attr('aria-expanded','true'); // set show/hide indicator to 'hide' on this question } } else { // if hideothers not set jQuery('#'+jQuery(this).attr("id")+'_a').slideToggle(speed); // toggle visibility of current answer jQuery('#'+jQuery(this).attr("id")+'_q').toggleClass("faq_is_open"); // toggle show/hide indicator of current question } } }); });
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Screen Reader Accessibility’ is closed to new replies.