Skip to content

Commit

Permalink
Dev: added div and aria-labelledby for label in question array
Browse files Browse the repository at this point in the history
Before, the label text was always shown inside a label element.
But, final users could insert HTML in the label text, such as
block elements.So it could build invalid HTML code.
Now, the label text is inserted inside a div element, and linked to
the input through the attribute aria-labelledby
  • Loading branch information
LouisGac committed Apr 12, 2016
1 parent 0af3e4e commit 167f1eb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ class="radio"
id="answer<?php echo $myfname;?>-<?php echo $ld; ?>"
<?php echo $CHECKED; ?>
onclick="<?php echo $checkconditionFunction; ?>(this.value, this.name, this.type)"
aria-labelledby="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>"
/>
<label for="answer<?php echo $myfname;?>-<?php echo $ld; ?>" >
<span class="hide label-text"><?php echo $label;?></span>

</label>

<!--
The label text is provided inside a div,
so final user can add paragraph, div, or whatever he wants in the subquestion text
This field is related to the input thanks to attribute aria-labelledby
-->
<div class="hide label-text" id="label-answer<?php echo $myfname;?>-<?php echo $ld; ?>">
<?php echo $label;?>
</div>
</td>
<!-- end of answer_td -->
1 change: 1 addition & 0 deletions templates/default/css/template.css
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ td.answer-item.text-center

/* center the label text in no more table mode */
.label-text{
display: inline;
position: relative;
bottom: 2px;
}

0 comments on commit 167f1eb

Please sign in to comment.