Commit 816882a1 by AlasdairSwan

Merge pull request #12358 from edx/alasdair/ECOM-4338-program-progress-a11y-update

Alasdair/ecom 4338 program progress a11y update
parents 2a8f44ad f5d24994
...@@ -108,7 +108,7 @@ define([ ...@@ -108,7 +108,7 @@ define([
completed = program.completed.length, completed = program.completed.length,
total = completed + program.in_progress.length + program.not_started.length; total = completed + program.in_progress.length + program.not_started.length;
expect(view.$('.certificate-status').html()).toEqual('You have earned certificates in ' + completed + ' of the ' + total + ' courses so far.'); expect(view.$('.certificate-status .status-text').not('.secondary').html()).toEqual('You have earned certificates in ' + completed + ' of the ' + total + ' courses so far.');
}); });
it('should render cards if there is no progressData', function() { it('should render cards if there is no progressData', function() {
......
...@@ -3,6 +3,14 @@ ...@@ -3,6 +3,14 @@
@import '../base/grid-settings'; @import '../base/grid-settings';
@import 'neat/neat'; // lib - Neat @import 'neat/neat'; // lib - Neat
%hide-until-focus {
@include left(0);
display: inline-block;
position: absolute;
top: -($baseline*30);
overflow: hidden;
}
.program-card{ .program-card{
@include span-columns(12); @include span-columns(12);
border: 1px solid $border-color-l3; border: 1px solid $border-color-l3;
...@@ -13,11 +21,11 @@ ...@@ -13,11 +21,11 @@
display: inline; display: inline;
.card-link{ .card-link{
@include left(0);
position: absolute; position: absolute;
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
left: 0;
border: 0; border: 0;
z-index: 1; z-index: 1;
opacity: 0.8; opacity: 0.8;
...@@ -25,14 +33,16 @@ ...@@ -25,14 +33,16 @@
&:focus{ &:focus{
opacity: 1; opacity: 1;
} }
.banner-image-container{ .banner-image-container{
position: relative; position: relative;
overflow: hidden; overflow: hidden;
height: 116px; height: 116px;
.banner-image{ .banner-image{
@include left(50%);
position: absolute; position: absolute;
top: 0; top: 0;
left: 50%;
z-index: 0; z-index: 0;
transform: translate(-50%, 0); transform: translate(-50%, 0);
min-height: 100%; min-height: 100%;
...@@ -89,8 +99,30 @@ ...@@ -89,8 +99,30 @@
} }
.certificate-status { .certificate-status {
font-size: em(12); .status-text {
color: $gray; font-size: em(12);
color: $gray;
}
.secondary {
@extend %hide-until-focus;
}
.status-text {
&:focus,
&:active {
position: relative;
top: auto;
width: auto;
height: auto;
margin: 0;
text-decoration: none;
& ~ .status-text {
@extend %hide-until-focus;
}
}
}
} }
.progress { .progress {
...@@ -98,9 +130,9 @@ ...@@ -98,9 +130,9 @@
background: $x-light; background: $x-light;
.bar { .bar {
@include float(left);
height: 100%; height: 100%;
position: relative; position: relative;
float: left;
&.complete { &.complete {
background: $success-dark; background: $success-dark;
......
...@@ -9,35 +9,37 @@ ...@@ -9,35 +9,37 @@
</div> </div>
</div> </div>
<% if (progress) { %> <% if (progress) { %>
<p id="status-<%- id %>" class="certificate-status"><%= interpolate( <p class="certificate-status">
gettext('You have earned certificates in %(completed_courses)s of the %(total_courses)s courses so far.'), <a href="<%- marketingUrl %>" class="status-text secondary" aria-describedby="program-<%- id %>"><%= interpolate(
{completed_courses: progress.total.completed, total_courses: progress.total.courses}, true
) %></p>
<% } %>
</div>
<% if (progress) { %>
<div class="progress">
<div class="bar complete" style="width:<%- progress.percentage.completed %>;"></div>
<div class="bar in-progress" style="width:<%- progress.percentage.in_progress %>;">
<span class="sr"><%= interpolate(
ngettext( ngettext(
'%(count)s course are in progress.', '%(count)s course is in progress.',
'%(count)s courses are in progress.', '%(count)s courses are in progress.',
progress.total.in_progress progress.total.in_progress
), ),
{count: progress.total.in_progress}, true {count: progress.total.in_progress}, true
) %></span> ) %></a>
</div>
<div class="bar not-started"> <a href="<%- marketingUrl %>" class="status-text secondary" aria-describedby="program-<%- id %>"><%= interpolate(
<span class="sr"><%= interpolate(
ngettext( ngettext(
'%(count)s course have not been started.', '%(count)s course has not been started.',
'%(count)s courses have not been started.', '%(count)s courses have not been started.',
progress.total.not_started progress.total.not_started
), ),
{count: progress.total.not_started}, true {count: progress.total.not_started}, true
) %></a>
<span id="status-<%- id %>" class="status-text"><%= interpolate(
gettext('You have earned certificates in %(completed_courses)s of the %(total_courses)s courses so far.'),
{completed_courses: progress.total.completed, total_courses: progress.total.courses}, true
) %></span> ) %></span>
</div> </p>
<% } %>
</div>
<% if (progress) { %>
<div class="progress">
<div class="bar complete" style="width:<%- progress.percentage.completed %>;"></div>
<div class="bar in-progress" style="width:<%- progress.percentage.in_progress %>;"></div>
<div class="bar not-started"></div>
</div> </div>
<% } %> <% } %>
<a href="<%- marketingUrl %>" class="card-link"> <a href="<%- marketingUrl %>" class="card-link">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment