From ec48fac67ba05180a7e48fd9f50d45ac261b5f50 Mon Sep 17 00:00:00 2001 From: Lax Mariappan Date: Mon, 3 Jul 2023 05:33:37 +0530 Subject: [PATCH 1/2] :bug: fix issue-3 improve steps accessibility --- build/index.asset.php | 2 +- build/index.js | 2 +- lib/WPCOTool/Frontend/Shortcode.php | 4 ++-- src/js/form.js | 10 ++++++++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/build/index.asset.php b/build/index.asset.php index 98305e5..3b6680c 100644 --- a/build/index.asset.php +++ b/build/index.asset.php @@ -1 +1 @@ - array(), 'version' => '92afa7b49854cb1ce35e'); + array(), 'version' => 'c3ad20dfab6b0989e5bf'); diff --git a/build/index.js b/build/index.js index 8d1994b..728480a 100644 --- a/build/index.js +++ b/build/index.js @@ -1 +1 @@ -(()=>{"use strict";var t,e={680:()=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,s=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r{if(!r){var s=1/0;for(l=0;l=o)&&Object.keys(n.O).every((t=>n.O[t](r[c])))?r.splice(c--,1):(a=!1,o0&&t[l-1][2]>o;l--)t[l]=t[l-1];t[l]=[r,i,o]},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={826:0,431:0};n.O.j=e=>0===t[e];var e=(e,r)=>{var i,o,[s,a,c]=r,u=0;if(s.some((e=>0!==t[e]))){for(i in a)n.o(a,i)&&(n.m[i]=a[i]);if(c)var l=c(n)}for(e&&e(r);un(680)));i=n.O(i)})(); \ No newline at end of file +(()=>{"use strict";var t,e={680:()=>{function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=function(t,e){if(t){if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var i=0,o=function(){};return{s:o,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,c=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return a=t.done,t},e:function(t){c=!0,s=t},f:function(){try{a||null==n.return||n.return()}finally{if(c)throw s}}}}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r{if(!r){var s=1/0;for(l=0;l=o)&&Object.keys(n.O).every((t=>n.O[t](r[c])))?r.splice(c--,1):(a=!1,o0&&t[l-1][2]>o;l--)t[l]=t[l-1];t[l]=[r,i,o]},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t={826:0,431:0};n.O.j=e=>0===t[e];var e=(e,r)=>{var i,o,[s,a,c]=r,u=0;if(s.some((e=>0!==t[e]))){for(i in a)n.o(a,i)&&(n.m[i]=a[i]);if(c)var l=c(n)}for(e&&e(r);un(680)));i=n.O(i)})(); \ No newline at end of file diff --git a/lib/WPCOTool/Frontend/Shortcode.php b/lib/WPCOTool/Frontend/Shortcode.php index d11cf81..ba661c8 100644 --- a/lib/WPCOTool/Frontend/Shortcode.php +++ b/lib/WPCOTool/Frontend/Shortcode.php @@ -389,9 +389,9 @@ private function get_form_header() { %4$d ', - $i === 1 ? sprintf( ' class="%s"', sprintf( '%s__steps--active', $this->prefix ) ) : '', // %1$s + $i === 1 ? sprintf( ' aria-current="page" class="%s"', sprintf( '%s__steps--active', $this->prefix ) ) : '', // %1$s sprintf( '%s__steps-text', $this->prefix ), // %2$s - sprintf( esc_html__( 'Step %d :', 'contributor-orientation-tool' ), $i ), // %3$s + sprintf( esc_html__( 'Step %d: ', 'contributor-orientation-tool' ), $i ), // %3$s $i, // %4$d sprintf( '%s__steps-responsive', $this->prefix ), // %5$d $this->steps[ $i ] // %6$d diff --git a/src/js/form.js b/src/js/form.js index 8c7d2cc..3d06b61 100644 --- a/src/js/form.js +++ b/src/js/form.js @@ -220,6 +220,16 @@ export default class Form { this.steps.removeClass(this.stepsActiveClass); this.steps.eq(section.index()).addClass(this.stepsActiveClass); + // Accessibility improvement for steps. + + let currentStep = document.getElementsByClassName(this.stepsActiveClass)[0]; + + document + .querySelector('[aria-current="page"]') + .removeAttribute("aria-current"); + + currentStep.setAttribute("aria-current", "page"); + } /** From 7ae7c70936d8af3d8e0a65a62e9e57128b02880a Mon Sep 17 00:00:00 2001 From: Lax Mariappan Date: Tue, 4 Jul 2023 05:13:59 +0530 Subject: [PATCH 2/2] remove link on team title --- lib/WPCOTool/Frontend/Shortcode.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/WPCOTool/Frontend/Shortcode.php b/lib/WPCOTool/Frontend/Shortcode.php index ba661c8..2d4db07 100644 --- a/lib/WPCOTool/Frontend/Shortcode.php +++ b/lib/WPCOTool/Frontend/Shortcode.php @@ -262,7 +262,7 @@ private function get_section( $id, $headline, $content, $button_next = '', $butt return sprintf( '
-

%2$s

+

%2$s

%3$s
@@ -341,7 +341,7 @@ private function get_team_checkbox_field( $name, $value, $team_icon, $team_name, return sprintf( '
- +

%6$s

%8$s
',