Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/4 improve question accessibility #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '92afa7b49854cb1ce35e');
<?php return array('dependencies' => array(), 'version' => 'c3ad20dfab6b0989e5bf');
2 changes: 1 addition & 1 deletion build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions lib/WPCOTool/Frontend/Shortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private function get_section( $id, $headline, $content, $button_next = '', $butt

return sprintf(
'<section id="%1$s" class="%6$s%7$s">
<h3>%2$s</h3>
<h2>%2$s</h2>
<div class="%11$s">
%3$s
<div class="%9$s"></div>
Expand Down Expand Up @@ -341,7 +341,7 @@ private function get_team_checkbox_field( $name, $value, $team_icon, $team_name,
return sprintf(
'<div class="%9$s">
<input id="%1$s" type="checkbox" name="%2$s[]" value="%3$s" />
<label for="%1$s"><a href="%7$s" title="%5$s" target="_blank">%4$s%5$s</a></label>
<label for="%1$s">%4$s%5$s</label>
<p>%6$s</p>
<a href="%7$s" title="%5$s" target="_blank">%8$s</a>
</div>',
Expand Down Expand Up @@ -389,9 +389,9 @@ private function get_form_header() {
</span>
<span class="%5$s">%4$d</span>
</li>',
$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
Expand Down
10 changes: 10 additions & 0 deletions src/js/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");

}

/**
Expand Down