[LON-CAPA-cvs] cvs: loncom /homework structuretags.pm
raeburn
raeburn at source.lon-capa.org
Mon May 11 07:49:47 EDT 2026
raeburn Mon May 11 11:49:47 2026 EDT
Modified files:
/loncom/homework structuretags.pm
Log:
- WCAG 2 compliance: include labels for form elements.
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.599 loncom/homework/structuretags.pm:1.600
--- loncom/homework/structuretags.pm:1.599 Fri Apr 3 18:09:24 2026
+++ loncom/homework/structuretags.pm Mon May 11 11:49:47 2026
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.599 2026/04/03 18:09:24 raeburn Exp $
+# $Id: structuretags.pm,v 1.600 2026/05/11 11:49:47 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -958,7 +958,7 @@
&mt('Show All Instances')
: &mt('Show All Foils');
- my $show_all= '<span class="LC_nobreak"><label for="showallfoils">'
+ my $show_all= '<span class="LC_nobreak"><label>'
.'<input type="checkbox" name="showallfoils"';
if (defined($env{'form.showallfoils'})) { $show_all.=' checked="checked"'; }
$show_all.= ' /> '.$show_all_foils_text
@@ -970,9 +970,9 @@
if (!$Apache::lonhomework::parsing_a_task) {
$result.="
<div class='LC_edit_problem_header_row1'>
-<span class=\"LC_nobreak\">
-".&mt("Problem Status:")."
-<select name='problemstate'>
+<span class=\"LC_nobreak\"><label for=\"problemstate\">
+".&mt("Problem Status:")."</label>
+<select name='problemstate' id='problemstate'>
<option value=''></option>
".&option('CLOSED' ,'problemstate').&mt("Closed")."</option>
".&option('CAN_ANSWER' ,'problemstate').&mt("Answerable")."</option>
@@ -981,9 +981,9 @@
".&option('SHOW_ANSWER' ,'problemstate').&mt("Show Answer")."</option>
</select>
</span>
-<span class=\"LC_nobreak\">
-".&mt("Problem Type:")."
-<select name='problemtype'>
+<span class=\"LC_nobreak\"><label for=\"problemtype\">
+".&mt("Problem Type:")."</label>
+<select name='problemtype' id='problemtype'>
<option value=''></option>
".&option('exam' ,'problemtype').&mt("Bubblesheet Exam Problem")."</option>
".&option('problem','problemtype').&mt("Homework Problem")."</option>
@@ -998,9 +998,9 @@
$show_all
</div>
<div class='LC_edit_problem_header_row2'>
-<span class=\"LC_nobreak\">
-".&mt("Feedback Mode:")."
-<select name='problemstatus'>
+<span class=\"LC_nobreak\"><label for=\"problemstatus\">
+".&mt("Feedback Mode:")."</label>
+<select name='problemstatus' id='problemstatus'>
<option value=''></option>
".&option('yes','problemstatus').&mt("Show Feedback")."</option>
".&option('no', 'problemstatus').&mt("Don't Show Incorrect/Correct Feedback")."</option>
@@ -1026,9 +1026,9 @@
";
}
$result.='
- <span class="LC_nobreak">
+ <span class="LC_nobreak"><label>
'.&mt('Apply style file: ').'
- <input type="text" name="style_file" value="'.&HTML::Entities::encode($env{'construct.style'},'"<>&').'" />
+ <input type="text" name="style_file" value="'.&HTML::Entities::encode($env{'construct.style'},'"<>&').'" /></label>
<a href="javascript:openbrowser(\'lonhomework\',\'style_file\',\'sty\')">'.&mt('Select').'</a>
</span>
</div>
@@ -1046,7 +1046,7 @@
<input type="submit" name="changerandseed" value="'.&mt('Change Random Seed To:').'" />
<input type="text" name="rndseed" size="24" value="'.
$rndseed.'"
- onchange="javascript:document.lonhomework.changerandseed.click()" />';
+ onchange="javascript:document.lonhomework.changerandseed.click()" aria-label="'.&mt('Enter Random Seed').'" />';
if (!$Apache::lonhomework::parsing_a_task) {
my $numtoanalyze=$env{'form.numtoanalyze'};
@@ -1056,7 +1056,7 @@
'<input type="button" name="submitmode" value="'.&mt('Calculate answers').'" '.
'onclick="javascript:setmode(this.form,'."'calcanswers'".')" />'
,'<input type="text" name="numtoanalyze" value="'.
- $numtoanalyze.'" size="5" />').
+ $numtoanalyze.'" size="5" aria-label="'.&mt('Number of answers to calculate').'" />').
&Apache::loncommon::help_open_topic("Analyze_Problem",'',undef,undef,300).
'</span>';
More information about the LON-CAPA-cvs
mailing list