Skip to content

Commit

Permalink
MCKIN-12227 Survey table labels and roles (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
murad-hubib authored and xitij2000 committed Jan 24, 2020
1 parent 5534f44 commit 1081354
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions poll/public/html/survey.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
<div class="poll-block-form-wrapper">
<h3 class="poll-header">{{block_name}}</h3>
<form>
<table class="survey-table">
<thead>
<tr>
<table class="survey-table" role="presentation">
<thead role="presentation">
<tr role="group">
<td></td>
{% for answer, label in answers %}
<th id="poll-{{block_id}}-{{answer}}" class="survey-answer" scope="col">{{label}}</th>
<th role="presentation" id="poll-{{block_id}}-{{answer}}" class="survey-answer" scope="col">{{label}}</th>
{% endfor %}
</tr>
</thead>
{% for key, question in questions %}
<tr class="survey-row" role="group" aria-labelledby="poll-{{block_id}}-{{key}}">
<th id="poll-{{block_id}}-{{key}}" class="survey-question" scope="row">
<th role="presentation" id="poll-{{block_id}}-{{key}}" class="survey-question" scope="row">
{% if question.img %}
<div class="poll-image-td">
<img src="{{question.img}}" alt="{{question.img_alt|default_if_none:''}}"/>
Expand All @@ -25,7 +25,7 @@ <h3 class="poll-header">{{block_name}}</h3>
{{question.label|safe}}
</th>
{% for answer, label in answers %}
<td class="survey-option" headers="poll-{{block_id}}-{{key}} poll-{{block_id}}-{{answer}}">
<td role="presentation" class="survey-option" headers="poll-{{block_id}}-{{key}} poll-{{block_id}}-{{answer}}">
{% with answer_count=forloop.counter %}
{% for answer, label in answers %}
{% if forloop.counter == answer_count %}
Expand All @@ -37,7 +37,7 @@ <h3 class="poll-header">{{block_name}}</h3>
{% if question.img_alt %}
aria-label="{{question.img_alt}} {{label}}"
{% else %}
aria-label="{{question.label|striptags}} {{label}}"
aria-label="{{label|safe}}"
{% endif %}
/>
<span class="visible-mobile-only">{{label}}</span>
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def package_data(pkg, roots):

setup(
name='xblock-poll',
version='1.9.2',
version='1.9.3',
description='An XBlock for polling users.',
packages=[
'poll',
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def test_survey_options_a11y(self):
self.assertEqual(len(options), len(answers))
for j, option in enumerate(options):
self.assertIn(answer_text[j], option.get_attribute('aria-label'))
self.assertIn(question_text[i], option.get_attribute('aria-label'))
self.assertIn(option.get_attribute('aria-label'), answer_text)

def fill_survey(self, assert_submit=False):
"""
Expand Down

0 comments on commit 1081354

Please sign in to comment.