[LON-CAPA-cvs] cvs: loncom(version_2_12_X) /interface domainprefs.pm

raeburn raeburn at source.lon-capa.org
Sun Jun 28 14:31:05 EDT 2026


raeburn		Sun Jun 28 18:31:05 2026 EDT

  Modified files:              (Branch: version_2_12_X)
    /loncom/interface	domainprefs.pm 
  Log:
  - For 2.12
    Backport 1.457, 1.458, 1.459, 1.460, 1.461.
  
  
-------------- next part --------------
Index: loncom/interface/domainprefs.pm
diff -u loncom/interface/domainprefs.pm:1.447.2.8 loncom/interface/domainprefs.pm:1.447.2.9
--- loncom/interface/domainprefs.pm:1.447.2.8	Fri Jan  9 22:18:40 2026
+++ loncom/interface/domainprefs.pm	Sun Jun 28 18:31:05 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to set domain-wide configuration settings
 #
-# $Id: domainprefs.pm,v 1.447.2.8 2026/01/09 22:18:40 raeburn Exp $
+# $Id: domainprefs.pm,v 1.447.2.9 2026/06/28 18:31:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -307,13 +307,13 @@
                    { text => 'Default color schemes',
                      help => 'Domain_Configuration_Color_Schemes',
                      header => [{col1 => 'Student Settings',
-                                 col2 => '',},
+                                 col2 => 'Details',},
                                 {col1 => 'Coordinator Settings',
-                                 col2 => '',},
+                                 col2 => 'Details',},
                                 {col1 => 'Author Settings',
-                                 col2 => '',},
+                                 col2 => 'Details',},
                                 {col1 => 'Administrator Settings',
-                                 col2 => '',}],
+                                 col2 => 'Details',}],
                       print => \&print_rolecolors,
                       modify => \&modify_rolecolors,
                     },
@@ -321,7 +321,7 @@
                     { text => 'Log-in page options',
                       help => 'Domain_Configuration_Login_Page',
                       header => [{col1 => 'Log-in Page Items',
-                                  col2 => '',},
+                                  col2 => 'Settings',},
                                  {col1 => 'Log-in Help',
                                   col2 => 'Value'},
                                  {col1 => 'Custom HTML in document head',
@@ -470,7 +470,7 @@
                   { text => 'Bubblesheet format',
                     help => 'Domain_Configuration_Scantron_Format',
                     header => [ {col1 => 'Bubblesheet format file',
-                                 col2 => ''},
+                                 col2 => 'Action'},
                                 {col1 => 'Bubblesheet data upload formats',
                                  col2 => 'Settings'}],
                     print => \&print_scantron,
@@ -484,9 +484,9 @@
                              {col1 => 'Setting',
                               col2 => 'Value'},
                              {col1 => 'Available textbooks',
-                              col2 => ''},
+                              col2 => 'Details'},
                              {col1 => 'Available templates',
-                              col2 => ''},
+                              col2 => 'Details'},
                              {col1 => 'Validation (not official courses)',
                               col2 => 'Value'},],
                   print => \&print_quotas,
@@ -506,11 +506,11 @@
                   { text => 'Cataloging of courses/communities',
                     help => 'Domain_Configuration_Cataloging_Courses',
                     header => [{col1 => 'Catalog type/availability',
-                                col2 => '',},
+                                col2 => 'Setting',},
                                {col1 => 'Category settings for standard catalog',
-                                col2 => '',},
+                                col2 => 'Setting',},
                                {col1 => 'Categories',
-                                col2 => '',
+                                col2 => 'Details',
                                }],
                     print => \&print_coursecategories,
                     modify => \&modify_coursecategories,
@@ -959,8 +959,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$rightcolspan.'>'.&mt($item->{'header'}->[0]->{'col2'}).'</td>
+              <th class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[0]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$rightcolspan.'>'.&mt($item->{'header'}->[0]->{'col2'}).'</th>
              </tr>';
         $rowtotal ++;
         if (($action eq 'autoupdate') || ($action eq 'usercreation') || ($action eq 'selfcreation') ||
@@ -996,8 +996,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[1]->{'col2'}).'</th>
              </tr>';
             $rowtotal ++;
         if (($action eq 'autoupdate') || ($action eq 'usercreation') ||
@@ -1022,8 +1022,8 @@
                           <td>
                           <table class="LC_nested">
                            <tr class="LC_info_row">
-                            <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
-                            <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td>
+                            <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</th>
+                            <th class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</th>
                            </tr>'."\n".
                            $item->{'print'}->('middle',$dom,$settings,\$rowtotal);
             } else {
@@ -1042,8 +1042,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col2'}).'</td></tr>'.
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[$trusthdrs[$i]]->{'col2'}).'</th></tr>'.
                            $item->{'print'}->($prefixes[$i],$dom,$settings,\$rowtotal).'
             </table>
           </td>
@@ -1054,8 +1054,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[8]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[8]->{'col2'}).'</td></tr>'.
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[8]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[8]->{'col2'}).'</th></tr>'.
                            $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
             } else {
                 my $hdridx = 2;
@@ -1070,8 +1070,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[$hdridx]->{'col1'}).'</td>
-              <td class="LC_right_item">'.&mt($item->{'header'}->[$hdridx]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[$hdridx]->{'col1'}).'</th>
+              <th class="LC_right_item">'.&mt($item->{'header'}->[$hdridx]->{'col2'}).'</th>
              </tr>'."\n";
                 if ($action eq 'coursecategories') {
                     $output .= &print_coursecategories('bottom',$dom,$item,$settings,\$rowtotal);
@@ -1084,7 +1084,6 @@
                     }
                     $hdridx ++;
                     $output .= '
-             </tr>
             </table>
            </td>
           </tr>
@@ -1092,18 +1091,13 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[$hdridx]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[$hdridx]->{'col2'}).'</td></tr>'."\n";
+              <th class="LC_left_item'.$leftnobr.'"'.$colspan.'>'.&mt($item->{'header'}->[$hdridx]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[$hdridx]->{'col2'}).'</th></tr>'."\n";
                     if ($action eq 'passwords') {
                         $output .= $item->{'print'}->('bottom',$dom,$confname,$settings,\$rowtotal);
                     } else {
                         $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
                     }
-                    $output .= '
-            </table>
-          </td>
-         </tr>
-         <tr>';
                 } else {
                     $output .= $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
                 }
@@ -1124,8 +1118,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</td></tr>'.
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</th></tr>'.
                            $item->{'print'}->('connfrom',$dom,$settings,\$rowtotal).'
             </table>
           </td>
@@ -1134,8 +1128,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td></tr>'.
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</th></tr>'.
                            $item->{'print'}->('bottom',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'login') {
             if ($numheaders == 5) {
@@ -1147,8 +1141,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</td></tr>'.
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</th></tr>'.
                        &print_login('help',$dom,$confname,$phase,$settings,\$rowtotal);
                 $rowtotal ++;
             } else {
@@ -1164,13 +1158,13 @@
              <tr class="LC_info_row">';
             if ($numheaders == 5) {
                 $output .= '
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</th>
              </tr>';
             } else {
                 $output .= '
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col2'}).'</th>
              </tr>';
             }
             $rowtotal ++;
@@ -1184,13 +1178,13 @@
              <tr class="LC_info_row">';
             if ($numheaders == 5) {
                 $output .= '
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[4]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[4]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[4]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[4]->{'col2'}).'</th>
              </tr>';
             } else {
                 $output .= '
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>
-              <td class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</th>
+              <th class="LC_right_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col2'}).'</th>
              </tr>';
             }
             $rowtotal ++;
@@ -1206,8 +1200,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</td>
-              <td class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</td> </tr>'.
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[2]->{'col1'}).'</th>
+              <th class="LC_right_item">'.&mt($item->{'header'}->[2]->{'col2'}).'</th> </tr>'.
                        &textbookcourses_javascript($settings).
                        &print_textbookcourses($dom,'textbooks',$settings,\$rowtotal).'
             </table>
@@ -1217,8 +1211,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>
-              <td class="LC_right_item">'.&mt($item->{'header'}->[3]->{'col2'}).'</td> </tr>'.
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</th>
+              <th class="LC_right_item">'.&mt($item->{'header'}->[3]->{'col2'}).'</th> </tr>'.
                        &print_textbookcourses($dom,'templates',$settings,\$rowtotal).'
             </table>
            </td>
@@ -1227,8 +1221,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.' style="vertical-align: top">'.&mt($item->{'header'}->[4]->{'col1'}).'</td>
-              <td class="LC_right_item" style="vertical-align: top">'.&mt($item->{'header'}->[4]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.' style="vertical-align: top">'.&mt($item->{'header'}->[4]->{'col1'}).'</th>
+              <th class="LC_right_item" style="vertical-align: top">'.&mt($item->{'header'}->[4]->{'col2'}).'</th>
              </tr>'.
             &print_validation_rows('requestcourses',$dom,$settings,\$rowtotal);
         } elsif ($action eq 'requestauthor') {
@@ -1243,10 +1237,10 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.' style="vertical-align: top">'.
-               &mt($item->{'header'}->[2]->{'col1'}).'</td>
-              <td class="LC_right_item" style="vertical-align: top">'.
-               &mt($item->{'header'}->[2]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.' style="vertical-align: top">'.
+               &mt($item->{'header'}->[2]->{'col1'}).'</th>
+              <th class="LC_right_item" style="vertical-align: top">'.
+               &mt($item->{'header'}->[2]->{'col2'}).'</th>
              </tr>'.
             &print_rolecolors($phase,'author',$dom,$confname,$settings,\$rowtotal).'
            </table>
@@ -1256,8 +1250,8 @@
            <td>
             <table class="LC_nested">
              <tr class="LC_info_row">
-              <td class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</td>
-              <td class="LC_right_item">'.&mt($item->{'header'}->[3]->{'col2'}).'</td>
+              <th class="LC_left_item"'.$colspan.'>'.&mt($item->{'header'}->[3]->{'col1'}).'</th>
+              <th class="LC_right_item">'.&mt($item->{'header'}->[3]->{'col2'}).'</th>
              </tr>'.
             &print_rolecolors($phase,'admin',$dom,$confname,$settings,\$rowtotal);
             $rowtotal += 2;
@@ -1270,43 +1264,51 @@
              <tr class="LC_info_row">';
         if ($action eq 'login') {
             $output .= '  
-              <td class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>';
+              <th class="LC_left_item" colspan="2">'.&mt($item->{'header'}->[0]->{'col1'}).'</th>';
         } elsif ($action eq 'serverstatuses') {
             $output .= '
-              <td class="LC_left_item" style="vertical-align: top">'.&mt($item->{'header'}->[0]->{'col1'}).
-              '<br />('.&mt('Automatic access for Dom. Coords.').')</td>';
+              <th class="LC_left_item" style="vertical-align: top">'.&mt($item->{'header'}->[0]->{'col1'}).
+              '<br />('.&mt('Automatic access for Dom. Coords.').')</th>';
 
         } else {
             $output .= '
-              <td class="LC_left_item" style="vertical-align: top">'.&mt($item->{'header'}->[0]->{'col1'}).'</td>';
+              <th class="LC_left_item" style="vertical-align: top">'.&mt($item->{'header'}->[0]->{'col1'}).'</th>';
         }
         if (defined($item->{'header'}->[0]->{'col3'})) {
-            $output .= '<td class="LC_left_item" style="vertical-align: top">'.
+            my $id;   
+            if ($action eq 'serverstatuses') {
+                $id = ' id="colheader2"';
+            }
+            $output .= '<th class="LC_left_item" style="vertical-align: top;"'.$id.'>'.
                        &mt($item->{'header'}->[0]->{'col2'});
             if ($action eq 'serverstatuses') {
                 $output .= '<br />(<tt>'.&mt('user1:domain1,user2:domain2 etc.').'</tt>)';
             } 
         } else {
-            $output .= '<td class="LC_right_item" style="vertical-align: top">'.
+            $output .= '<th class="LC_right_item" style="vertical-align: top">'.
                        &mt($item->{'header'}->[0]->{'col2'});
         }
-        $output .= '</td>';
+        $output .= '</th>';
         if ($item->{'header'}->[0]->{'col3'}) {
             if (defined($item->{'header'}->[0]->{'col4'})) {
-                $output .= '<td class="LC_left_item" style="vertical-align: top">'.
+                $output .= '<th class="LC_left_item" style="vertical-align: top">'.
                             &mt($item->{'header'}->[0]->{'col3'});
             } else {
-                $output .= '<td class="LC_right_item" style="vertical-align: top">'.
+                my $id;
+                if ($action eq 'serverstatuses') {
+                    $id = ' id="colheader3"';
+                }
+                $output .= '<th class="LC_right_item" style="vertical-align: top"'.$id.'>'.
                            &mt($item->{'header'}->[0]->{'col3'});
             }
             if ($action eq 'serverstatuses') {
                 $output .= '<br />(<tt>'.&mt('IP1,IP2 etc.').'</tt>)';
             }
-            $output .= '</td>';
+            $output .= '</th>';
         }
         if ($item->{'header'}->[0]->{'col4'}) {
-            $output .= '<td class="LC_right_item" style="vertical-align: top">'.
-                       &mt($item->{'header'}->[0]->{'col4'});
+            $output .= '<th class="LC_right_item" style="vertical-align: top">'.
+                       &mt($item->{'header'}->[0]->{'col4'}).'</th>';
         }
         $output .= '</tr>';
         $rowtotal ++;
@@ -1340,25 +1342,30 @@
         $css_class = ' class="LC_odd_row"';
         $datatable .= '<tr'.$css_class.'><td>'.$choice.'</td>'.
                       '<td style="text-align: right"><table><tr><th>'.$choices{'hostid'}.'</th>'.
-                      '<th>'.$choices{'server'}.'</th>'.
-                      '<th>'.$choices{'serverpath'}.'</th>'.
-                      '<th>'.$choices{'custompath'}.'</th>'.
-                      '<th><span class="LC_nobreak">'.$choices{'exempt'}.'</span></th></tr>'."\n";
+                      '<th id="login_service_redirect">'.$choices{'server'}.'</th>'.
+                      '<th id="login_service_path">'.$choices{'serverpath'}.'</th>'.
+                      '<th id="login_service_custompath">'.$choices{'custompath'}.'</th>'.
+                      '<th id="login_service_exempt"><span class="LC_nobreak">'.$choices{'exempt'}.'</span></th></tr>'."\n";
         my %disallowed;
         if (ref($settings) eq 'HASH') {
             if (ref($settings->{'loginvia'}) eq 'HASH') {
                %disallowed = %{$settings->{'loginvia'}};
             }
         }
+        my $service_rownum = 0;
         foreach my $lonhost (sort(keys(%servers))) {
+            $service_rownum ++;
             my $direct = 'selected="selected"';
             if (ref($disallowed{$lonhost}) eq 'HASH') {
                 if ($disallowed{$lonhost}{'server'} ne '') {
                     $direct = '';
                 }
             }
-            $datatable .= '<tr><td>'.$servers{$lonhost}.'</td>'.
-                          '<td><select name="'.$lonhost.'_server">'.
+            $datatable .= '<tr>'.
+                          '<th class="LC_rowheader" scope="row" id="login_service_server_'.$service_rownum.'">'.
+                          $servers{$lonhost}.'</th>'.
+                          '<td><select name="'.$lonhost.'_server" aria-labelledby="'.
+                          'login_service_server_'.$service_rownum.' login_service_redirect">'.
                           '<option value=""'.$direct.'>'.$choices{'directlogin'}.
                           '</option>';
             foreach my $hostid (sort(keys(%servers))) {
@@ -1373,7 +1380,8 @@
                               $servers{$hostid}.'</option>';
             }
             $datatable .= '</select></td>'.
-                          '<td><select name="'.$lonhost.'_serverpath">';
+                          '<td><select name="'.$lonhost.'_serverpath" aria-labelledby="'.
+                          'login_service_server_'.$service_rownum.' login_service_path">';
             foreach my $path ('','/','/adm/login','/adm/roles','custom') {
                 my $pathname = $path;
                 if ($path eq 'custom') {
@@ -1395,9 +1403,11 @@
                 $custom = $disallowed{$lonhost}{'custompath'};
                 $exempt = $disallowed{$lonhost}{'exempt'};
             }
-            $datatable .= '<td><input type="text" name="'.$lonhost.'_custompath" size="6" value="'.$custom.'" /></td>'.
-                          '<td><input type="text" name="'.$lonhost.'_exempt" size="8" value="'.$exempt.'" /></td>'.
-                          '</tr>';
+            $datatable .= '<td><input type="text" name="'.$lonhost.'_custompath" size="6" value="'.$custom.'" '.
+                          'aria-labelledby="login_service_server_'.$service_rownum.' login_service_custompath" /></td>'.
+                          '<td><input type="text" name="'.$lonhost.'_exempt" size="8" value="'.$exempt.'" '.
+                          'aria-labelledby="login_service_server_'.$service_rownum.' login_service_exempt" />'.
+                          '</td></tr>';
         }
         $datatable .= '</table></td></tr>';
         return $datatable;
@@ -1525,15 +1535,17 @@
             $datatable .=  
                 '<tr'.$css_class.'><td colspan="2">'.$choices{$item}.
                 '</td><td>'.
+                '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                '<legend class="LC_visually_hidden">'.$choices{$item}.'</legend>'.
                 '<span class="LC_nobreak"><label><input type="radio" name="'.
                 $item.'"'.$checkedon{$item}.' value="1" />'.&mt('Yes').
                 '</label> <label><input type="radio" name="'.$item.'"'.
-                $checkedoff{$item}.' value="0" />'.&mt('No').'</label></span></td>'.
+                $checkedoff{$item}.' value="0" />'.&mt('No').'</label></span></fieldset></td>'.
                 '</tr>';
             $itemcount ++;
         }
         $datatable .= &display_color_options($dom,$confname,$phase,'login',$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,\@logintext);
-        $datatable .= '</tr></table></td></tr>';
+	#        $datatable .= '</div></div></td></tr>';
     } elsif ($caller eq 'help') {
         my ($defaulturl,$defaulttype,%url,%type,%langchoices);
         my $itemcount = 1;
@@ -1559,6 +1571,7 @@
         foreach my $lang ('nolang',sort(@currlangs)) {
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             $datatable .= '<tr'.$css_class.'>';
+            my $labeltext;
             if ($url{$lang} eq '') {
                 $url{$lang} = $defaulturl;
             }
@@ -1569,10 +1582,12 @@
             if ($lang eq 'nolang') {
                 $datatable .= &mt('Log-in help page if no specific language file: [_1]',
                                   &Apache::loncommon::modal_link($url{$lang},$lt{$type{$lang}},600,500));
+                $labeltext = &mt('Choose help file if no specific language');
             } else {
                 $datatable .= &mt('Log-in help page for language: [_1] is [_2]',
                                   $langchoices{$lang},
                                   &Apache::loncommon::modal_link($url{$lang},$lt{$type{$lang}},600,500));
+                $labeltext = &mt('Choose help file for language: [_1]',$langchoices{$lang}); 
             }
             $datatable .= '</span></td>'."\n".
                           '<td class="LC_left_item">';
@@ -1587,7 +1602,7 @@
             if ($switchserver) {
                 $datatable .= &mt('Upload to library server: [_1]',$switchserver);
             } else {
-                $datatable .= '<input type="file" name="loginhelpurl_'.$lang.'" />';
+                $datatable .= '<input type="file" name="loginhelpurl_'.$lang.'" aria-label="'.$labeltext.'" />';
             }
             $datatable .= '</td></tr>';
             $itemcount ++;
@@ -1603,13 +1618,15 @@
             $toadd{''} = &mt('Select');
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             $datatable .= '<tr'.$css_class.'><td class="LC_left_item" colspan="2">'.
-                          &mt('Add log-in help page for a specific language:').' '.
-                          &Apache::loncommon::select_form('','loginhelpurl_add_lang',\%toadd).
+                          '<label for="loginhelpurl_add_lang">'.
+                          &mt('Add log-in help page for a specific language:').'</label> '.
+                          &Apache::loncommon::select_form('','loginhelpurl_add_lang',\%toadd,'','','loginhelpurl_add_lang').
                           '</td><td class="LC_left_item">'.$lt{'upl'}.'<br />';
+            my $arialabel = &mt('Choose log-in help page for added specific language');
             if ($switchserver) {
                 $datatable .= &mt('Upload to library server: [_1]',$switchserver);
             } else {
-                $datatable .= '<input type="file" name="loginhelpurl_add_file" />';
+                $datatable .= '<input type="file" name="loginhelpurl_add_file"  aria-label="'.$arialabel.'" />';
             }
             $datatable .= '</td></tr>';
             $itemcount ++;
@@ -1622,8 +1639,8 @@
         $datatable .= '<tr'.$css_class.'><td colspan="2">'.$choice.'</td>'.
                       '<td style="text-align: left"><table><tr><th>'.$choices{'hostid'}.'</th>'.
                       '<th>'.$choices{'current'}.'</th>'.
-                      '<th>'.$choices{'action'}.'</th>'.
-                      '<th>'.$choices{'exempt'}.'</th></tr>'."\n";
+                      '<th id="login_headtag_action">'.$choices{'action'}.'</th>'.
+                      '<th id="login_headtag_exempt">'.$choices{'exempt'}.'</th></tr>'."\n";
         my (%currurls,%currexempt);
         if (ref($settings) eq 'HASH') {
             if (ref($settings->{'headtag'}) eq 'HASH') {
@@ -1635,9 +1652,12 @@
                 }
             }
         }
+        my $headtag_rownum = 0;
         foreach my $lonhost (sort(keys(%domservers))) {
+            $headtag_rownum ++;
             my $exempt = &check_exempt_addresses($currexempt{$lonhost});
-            $datatable .= '<tr><td>'.$domservers{$lonhost}.'</td>';
+            $datatable .= '<tr><th id="login_headtag_server_'.$headtag_rownum.'" class="LC_rowheader" scope="row">'.
+                          $domservers{$lonhost}.'</th>';
             if ($currurls{$lonhost}) {
                 $datatable .= '<td class="LC_right_item"><a href="'.
                               "javascript:void(open('$currurls{$lonhost}?inhibitmenu=yes','Custom_HeadTag',
@@ -1653,9 +1673,9 @@
             if ($switchserver) {
                 $datatable .= &mt('Upload to library server: [_1]',$switchserver);
             } else {
-                $datatable .= '<input type="file" name="loginheadtag_'.$lonhost.'" />';
+                $datatable .= '<input type="file" name="loginheadtag_'.$lonhost.'" aria-labelledby="login_headtag_action login_headtag_server_'.$headtag_rownum.'" />';
             }
-            $datatable .= '</td><td><input type="text" name="loginheadtagexempt_'.$lonhost.'" value="'.$exempt.'" /></td></tr>';
+            $datatable .= '</td><td><input type="text" name="loginheadtagexempt_'.$lonhost.'" value="'.$exempt.'" aria-labelledby="login_headtag_exempt login_headtag_server_'.$headtag_rownum.'" /></td></tr>';
         }
         $datatable .= '</table></td></tr>';
     } elsif ($caller eq 'saml') {
@@ -1667,7 +1687,7 @@
         my (%saml,%samltext,%samlimg,%samlalt,%samlurl,%samltitle,%samlwindow,%samlnotsso,%styleon,%styleoff);
         foreach my $lonhost (keys(%domservers)) {
             $samlurl{$lonhost} = '/adm/sso';
-            $styleon{$lonhost} = 'display:none';
+            $styleon{$lonhost} = 'display: none;';
             $styleoff{$lonhost} = '';
         }
         if ((ref($settings) eq 'HASH') && (ref($settings->{'saml'}) eq 'HASH')) {
@@ -1682,9 +1702,9 @@
                     $samlwindow{$lonhost} = $settings->{'saml'}{$lonhost}{'window'};
                     $samlnotsso{$lonhost} = $settings->{'saml'}{$lonhost}{'notsso'};
                     $styleon{$lonhost} = '';
-                    $styleoff{$lonhost} = 'display:none';
+                    $styleoff{$lonhost} = 'display: none;';
                 } else {
-                    $styleon{$lonhost} = 'display:none';
+                    $styleon{$lonhost} = 'display: none;';
                     $styleoff{$lonhost} = '';
                 }
             }
@@ -1705,18 +1725,22 @@
             }
             my $css_class = $itemcount%2?' class="LC_odd_row"':'';
             $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.$domservers{$lonhost}.'</span></td>'.
-                          '<td><span class="LC_nobreak"><label><input type="radio" name="saml_'.$lonhost.'"'.$samloff.
+                          '<td><fieldset class="LC_borderless">'.
+                          '<legend class="LC_virtually_hidden">'.&mt('Dual login for [_1]?',$domservers{$lonhost}).
+                          '</legend>'.
+                          '<span class="LC_nobreak"><label><input type="radio" name="saml_'.$lonhost.'"'.$samloff.
                           'onclick="toggleSamlOptions(this.form,'."'$lonhost'".');" value="0" />'.
                           &mt('No').'</label>'.(' 'x2).
                           '<label><input type="radio" name="saml_'.$lonhost.'"'.$samlon.
                           'onclick="toggleSamlOptions(this.form,'."'$lonhost'".');" value="1" />'.
-                          &mt('Yes').'</label></span></td>'.
+                          &mt('Yes').'</label></span></fieldset></td>'.
                           '<td id="samloptionson_'.$lonhost.'" style="'.$styleon{$lonhost}.'" width="100%">'.
                           '<table width="100%"><tr><th colspan="3" align="center">'.&mt('SSO').'</th></tr>'.
                           '<tr><th>'.&mt('Text').'</th><th>'.&mt('Image').'</th>'.
                           '<th>'.&mt('Alt Text').'</th></tr>'.
                           '<tr'.$css_class.'><td><input type="text" name="saml_text_'.$lonhost.'" size="20" value="'.
-                          $samltext{$lonhost}.'" /></td><td>';
+                          $samltext{$lonhost}.'" aria-label="'.
+                          &mt("Text to display when state is 'SSO login' for [_1]",$domservers{$lonhost}).'" /></td><td>';
             if ($samlimg{$lonhost}) {
                 $datatable .= '<img src="'.$samlimg{$lonhost}.'" /><br />'.
                               '<span class="LC_nobreak"><label>'.
@@ -1729,26 +1753,34 @@
             if ($switchserver) {
                 $datatable .= &mt('Upload to library server: [_1]',$switchserver);
             } else {
-                $datatable .= '<input type="file" name="saml_img_'.$lonhost.'" />';
+                $datatable .= '<input type="file" name="saml_img_'.$lonhost.'" aria-label="'.
+                              &mt('Choose image file for SSO login button for [_1]',$domservers{$lonhost}).'" />';
             }
             $datatable .= '</td>'.
                           '<td><input type="text" name="saml_alt_'.$lonhost.'" size="25" '.
-                          'value="'.$samlalt{$lonhost}.'" /></td></tr></table><br />'.
+                          'value="'.$samlalt{$lonhost}.'" aria-label="'.
+                          &mt('alt text for SSO login button image for [_1]',$domservers{$lonhost}).'" />'.
+                          '</td></tr></table><br />'.
                           '<table width="100%"><tr><th colspan="3" align="center">'.&mt('SSO').'</th><th align="center">'.
                           '<span class="LC_nobreak">'.&mt('Non-SSO').'</span></th></tr>'.
                           '<tr><th>'.&mt('URL').'</th><th>'.&mt('Tool Tip').'</th>'.
                           '<th>'.&mt('Pop-up if iframe').'</th><th>'.&mt('Text').'</th></tr>'.
                           '<tr'.$css_class.'>'.
                           '<td><input type="text" name="saml_url_'.$lonhost.'" size="30" '.
-                          'value="'.$samlurl{$lonhost}.'" /></td>'.
-                          '<td><textarea name="saml_title_'.$lonhost.'" rows="3" cols="20">'.
+                          'value="'.$samlurl{$lonhost}.'" aria-label="'.
+                          &mt('URL to load when SSO Login button pushed for [_1]',$domservers{$lonhost}).'" /></td>'.
+                          '<td><textarea name="saml_title_'.$lonhost.'" rows="3" cols="20" aria-label="'.
+			  &mt('Text to display when user hovers over SSO Login button for [_1]',$domservers{$lonhost}).'">'.
                           $samltitle{$lonhost}.'</textarea></td>'.
-                          '<td><label><input type="radio" name="saml_window_'.$lonhost.'" value=""'.$samlwinoff.'>'.
-                          &mt('No').'</label>'.(' 'x2).'<label><input type="radio" '.
-                          'name="saml_window_'.$lonhost.'" value="1"'.$samlwinon.'>'.&mt('Yes').'</label></td>'.
+                          '<td><fieldset class="LC_borderless">'.
+                          '<legend class="LC_visually_hidden">'.&mt('Pop-up if iframe').'</legend>'.
+                          '<span class="LC_nobreak"><label><input type="radio" name="saml_window_'.$lonhost.'" value=""'.$samlwinoff.' />'.
+                          &mt('No').'</label></span>'.(' 'x2).' <span class="LC_nobreak"><label><input type="radio" '.
+                          'name="saml_window_'.$lonhost.'" value="1"'.$samlwinon.' />'.&mt('Yes').'</label></span></fieldset></td>'.
                           '<td><input type="text" name="saml_notsso_'.$lonhost.'" size="12" '.
-                          'value="'.$samlnotsso{$lonhost}.'" /></td></tr>'.
-                          '</table></td>'.
+                          'value="'.$samlnotsso{$lonhost}.'" aria-label="'.
+                          &mt("Text to display when state is not 'SSO login' for [_1]",$domservers{$lonhost}).'" />'.
+                          '</td></tr></table></td>'.
                           '<td id="samloptionsoff_'.$lonhost.'" style="'.$styleoff{$lonhost}.'" width="100%"> </td></tr>';
            $itemcount ++;
         }
@@ -1843,8 +1875,9 @@
                 }
             }
             my $chgstr = ' onchange="javascript:reorderIPaccess(this.form,'."'ipaccess_pos_".$item."'".');"';
+            my $labeltext = &mt('Set list order for existing access control');
             $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'
-                         .'<select name="ipaccess_pos_'.$item.'"'.$chgstr.'>';
+                         .'<select name="ipaccess_pos_'.$item.'"'.$chgstr.' aria=label="'.$labeltext.'">';
             for (my $k=0; $k<=$maxnum; $k++) {
                 my $vpos = $k+1;
                 my $selstr;
@@ -1864,9 +1897,10 @@
     }
     $css_class = $itemcount%2?' class="LC_odd_row"':'';
     my $chgstr = ' onchange="javascript:reorderIPaccess(this.form,'."'ipaccess_pos_add'".');"';
+    my $arialabel = &mt('Set list order for new access control');
     $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n".
                   '<input type="hidden" name="ipaccess_maxnum" value="'.$maxnum.'" />'."\n".
-                  '<select name="ipaccess_pos_add"'.$chgstr.'>';
+                  '<select name="ipaccess_pos_add"'.$chgstr.' aria-label="'.$arialabel.'">';
     for (my $k=0; $k<$maxnum+1; $k++) {
         my $vpos = $k+1;
         my $selstr;
@@ -1876,7 +1910,7 @@
         $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
     }
     $datatable .= '</select> '."\n".
-                  '<input type="checkbox" name="ipaccess_add" value="1" />'.&mt('Add').'</span></td>'."\n".
+                  '<label><input type="checkbox" name="ipaccess_add" value="1" />'.&mt('Add').'</label></span></td>'."\n".
                   '<td colspan="2">'.
                   &ipaccess_options('add',$itemcount,$dom).
                   '</td>'."\n".
@@ -1894,32 +1928,44 @@
     if (ref($coursesref) eq 'HASH') {
         %currcourses = %{$coursesref};
     }
-    $output = '<fieldset><legend>'.&mt('Location(s)').'</legend>'.
-              '<span class="LC_nobreak">'.&mt('Name').': '.
-              '<input type="text" name="ipaccess_name_'.$num.'" value="'.$name.'" />'.
+    my %lt = &Apache::lonlocal::texthash (
+        loc => 'Location(s)',
+        ips => 'IP Range(s)',
+        fun => 'Functionality Blocked?',
+        coa => 'Courses/Communities allowed',
+        use => 'use Select link',
+        add => 'Add a Course or Community for which access is allowed',
+        for => 'Format for each IP range',
+        ran => 'Range(s) will be stored as IP netblock(s) in CIDR notation (comma separated)',   
+    );
+    $output = '<fieldset><legend>'.$lt{'loc'}.'</legend>'.
+              '<span class="LC_nobreak"><label>'.&mt('Name').': '.
+              '<input type="text" name="ipaccess_name_'.$num.'" value="'.$name.'" /></label>'.
               '</span></fieldset>'.
-              '<fieldset><legend>'.&mt('IP Range(s)').'</legend>'.
-              &mt('Format for each IP range').': '.&mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'<br />'.
-              &mt('Range(s) will be stored as IP netblock(s) in CIDR notation (comma separated)').'<br />'.
-              '<textarea name="ipaccess_range_'.$num.'" rows="3" cols="80">'.
+              '<fieldset><legend>'.$lt{'ips'}.'</legend>'.
+              $lt{'for'}.': '.&mt('[_1] or [_2]','A.B.C.D/N','A.B.C.D-E.F.G.H').'<br />'.
+              $lt{'ran'}.'<br />'.
+              '<textarea name="ipaccess_range_'.$num.'" rows="3" cols="80" aria-label="'.$lt{'ips'}.'">'.
               $ipranges.'</textarea></fieldset>'.
-              '<fieldset><legend>'.&mt('Functionality Blocked?').'</legend>'.
+              '<fieldset><legend>'.$lt{'fun'}.'</legend>'.
               &blocker_checkboxes($num,$blocksref).'</fieldset>'.
-              '<fieldset><legend>'.&mt('Courses/Communities allowed').'</legend>'.
-              '<table>';
+              '<fieldset><legend>'.$lt{'coa'}.'</legend>'.
+              '<div class="LC_grid" role="grid">';
     foreach my $cid (sort(keys(%currcourses))) {
         my %courseinfo = &Apache::lonnet::coursedescription($cid,{'one_time' => 1});
-        $output .= '<tr><td><span class="LC_nobreak">'.
+        $output .= '<div class="LC_grid_row" role="row">'.
+                   '<div class="LC_grid_cell" role"gridcell"><span class="LC_nobreak">'.
                    '<label><input type="checkbox" name="ipaccess_course_delete_'.$num.'" value="'.$cid.'" />'.
                    &mt('Delete?').' <span class="LC_cusr_emph">'.$courseinfo{'description'}.'</span></label></span>'.
-                   ' <span class="LC_fontsize_medium">('.$cid.')</span></td></tr>';
+                   ' <span class="LC_fontsize_medium">('.$cid.')</span></div></div>';
     }
-    $output .= '<tr><td><span class="LC_nobreak">'.&mt('Add').': '.
-               '<input type="text" name="ipaccess_cdesc_'.$num.'" value="" onfocus="this.blur();opencrsbrowser('."'display','ipaccess_cnum_$num','ipaccess_cdom_$num','ipaccess_cdesc_$num'".');" />'.
+    $output .= '<div class="LC_grid_row" role="row">'.
+               '<div class="LC_grid_cell" role="gridcell"><span class="LC_nobreak">'.&mt('Add').': '.
+               '<input type="text" name="ipaccess_cdesc_'.$num.'" value="" readonly="readonly" placeholder="'.$lt{'use'}.'" aria-label="'.$lt{'add'}.'" />'.
                 &Apache::loncommon::selectcourse_link('display','ipaccess_cnum_'.$num,'ipaccess_cdom_'.$num,'ipaccess_cdesc_'.$num,$dom,undef,'Course/Community').
                '<input type="hidden" name="ipaccess_cnum_'.$num.'" value="" />'.
                '<input type="hidden" name="ipaccess_cdom_'.$num.'" value="" />'.
-               '</span></td></tr></table>'."\n".
+               '</span></div></div></div>'."\n".
                '</fieldset>';
     return $output;
 }
@@ -1928,7 +1974,7 @@
     my ($num,$blocks) = @_;
     my ($typeorder,$types) = &commblocktype_text();
     my $numinrow = 6;
-    my $output = '<table>';
+    my $output = '<div class="LC_grid" role="grid">';
     for (my $i=0; $i<@{$typeorder}; $i++) {
         my $block = $typeorder->[$i];
         my $blockstatus;
@@ -1940,20 +1986,11 @@
         my $rem = $i%($numinrow);
         if ($rem == 0) {
             if ($i > 0) {
-                $output .= '</tr>';
+                $output .= '</div>';
             }
-            $output .= '<tr>';
-        }
-        if ($i == scalar(@{$typeorder})-1) {
-            my $colsleft = $numinrow-$rem;
-            if ($colsleft > 1) {
-                $output .= '<td colspan="'.$colsleft.'">';
-            } else {
-                $output .= '<td>';
-            }
-        } else {
-            $output .= '<td>';
+            $output .= '<div class="LC_grid_row" role="row">';
         }
+        $output .= '<div class="LC_grid_cell" role="gridcell">';
         my $item = 'ipaccess_block_'.$num;
         if ($blockstatus) {
             $blockstatus = ' '.$blockstatus;
@@ -1962,9 +1999,9 @@
                    '<input type="checkbox" name="'.$item.'"'.
                    $blockstatus.' value="'.$block.'"'.' />'.
                    $types->{$block}.'</label></span>'."\n".
-                   '<br /></td>';
+                   '<br /></div>';
     }
-    $output .= '</tr></table>';
+    $output .= '</div></div>';
     return $output;
 }
 
@@ -1994,12 +2031,13 @@
     my %choices = &color_font_choices();
     my @bgs = ('pgbg','tabbg','sidebg');
     my @links = ('link','alink','vlink');
+    my @alerts = ('error','warning','info','success');
     my @images = ();
     my %alt_text = &Apache::lonlocal::texthash(img => "Banner for $role role");
     my %designhash = &Apache::loncommon::get_domainconf($dom);
     my %defaultdesign = %Apache::loncommon::defaultdesign;
     my (%is_custom,%designs);
-    my %defaults = &role_defaults($role,\@bgs,\@links,\@images);
+    my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@alerts);
     if (ref($settings) eq 'HASH') {
         if (ref($settings->{$role}) eq 'HASH') {
             if ($settings->{$role}->{'font'} ne '') {
@@ -2022,6 +2060,12 @@
                     $is_custom{$item} = 1;
                 }
             }
+            foreach my $item (@alerts) {
+                if ($settings->{$role}->{$item} ne '') {
+                    $designs{'alerts'}{$item} = $settings->{$role}->{$item};
+                    $is_custom{$item} = 1;
+                }
+            }
         }
     } else {
         if ($designhash{$dom.'.'.$role.'.fontmenu'} ne '') {
@@ -2036,7 +2080,6 @@
             if ($designhash{$dom.'.'.$role.'.'.$item} ne '') {
                 $designs{'bgs'}{$item} = $designhash{$dom.'.'.$role.'.'.$item};
                 $is_custom{$item} = 1;
-            
             }
         }
         foreach my $item (@links) {
@@ -2045,15 +2088,21 @@
                 $is_custom{$item} = 1;
             }
         }
+        foreach my $item (@alerts) {
+            if ($designhash{$dom.'.'.$role.'.'.$item} ne '') {
+                $designs{'alerts'}{$item} = $designhash{$dom.'.'.$role.'.'.$item};
+                $is_custom{$item} = 1;
+            }
+        }
     }
     my $itemcount = 1;
-    my $datatable = &display_color_options($dom,$confname,$phase,$role,$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal);
-    $datatable .= '</tr></table></td></tr>';
+    my $datatable = &display_color_options($dom,$confname,$phase,$role,$itemcount,\%choices,\%is_custom,\%defaults,\%designs,\@images,\@bgs,\@links,\%alt_text,$rowtotal,'',\@alerts);
+    $datatable .= '</div></div></td></tr>';
     return $datatable;
 }
 
 sub role_defaults {
-    my ($role,$bgs,$links,$images,$logintext) = @_;
+    my ($role,$bgs,$links,$images,$alerts,$logintext) = @_;
     my %defaults;
     unless ((ref($bgs) eq 'ARRAY') && (ref($links) eq 'ARRAY') && (ref($images) eq 'ARRAY')) {
         return %defaults;
@@ -2076,6 +2125,11 @@
                        font => $defaultdesign{$role.'.font'},
                        fontmenu => $defaultdesign{$role.'.fontmenu'},
                     );
+        if (ref($alerts) eq 'ARRAY') {
+            foreach my $item (@{$alerts}) {
+                $defaults{'alerts'}{$item} = $defaultdesign{$role.'.'.$item};
+            }
+        }
     }
     foreach my $item (@{$bgs}) {
         $defaults{'bgs'}{$item} = $defaultdesign{$role.'.'.$item};
@@ -2091,11 +2145,11 @@
 
 sub display_color_options {
     my ($dom,$confname,$phase,$role,$itemcount,$choices,$is_custom,$defaults,$designs,
-        $images,$bgs,$links,$alt_text,$rowtotal,$logintext) = @_;
+        $images,$bgs,$links,$alt_text,$rowtotal,$logintext,$alerts) = @_;
     my $londocroot = $Apache::lonnet::perlvar{'lonDocRoot'};
     my $css_class = $itemcount%2?' class="LC_odd_row"':'';
     my $datatable = '<tr'.$css_class.'>'.
-        '<td>'.$choices->{'font'}.'</td>';
+        '<td><label for="'.$role.'_font">'.$choices->{'font'}.'</label></td>';
     if (!$is_custom->{'font'}) {
         $datatable .=  '<td>'.&mt('Default in use:').' <span class="css_default_'.$role.'_font" style="color: '.$defaults->{'font'}.';">'.$defaults->{'font'}.'</span></td>';
     } else {
@@ -2104,12 +2158,12 @@
     my $current_color = $designs->{'font'} ? $designs->{'font'} : $defaults->{'font'};
 
     $datatable .= '<td><span class="LC_nobreak">'.
-                  '<input type="text" class="colorchooser" size="10" name="'.$role.'_font"'.
+                  '<input type="text" class="colorchooser" size="10" name="'.$role.'_font" id="'.$role.'_font"'.
                   ' value="'.$current_color.'" /> '.
                   ' </span></td></tr>';
     unless ($role eq 'login') { 
         $datatable .= '<tr'.$css_class.'>'.
-                      '<td>'.$choices->{'fontmenu'}.'</td>';
+                      '<td><label for="'.$role.'_fontmenu">'.$choices->{'fontmenu'}.'</label></td>';
         if (!$is_custom->{'fontmenu'}) {
             $datatable .=  '<td>'.&mt('Default in use:').' <span class="css_default_'.$role.'_font" style="color: '.$defaults->{'fontmenu'}.';">'.$defaults->{'fontmenu'}.'</span></td>';
         } else {
@@ -2119,7 +2173,7 @@
 	    $designs->{'fontmenu'} : $defaults->{'fontmenu'};
         $datatable .= '<td><span class="LC_nobreak">'.
                       '<input class="colorchooser" type="text" size="10" name="'
-		      .$role.'_fontmenu"'.
+		      .$role.'_fontmenu" id="'.$role.'_fontmenu"'.
                       ' value="'.$current_color.'" /> '.
                       ' </span></td></tr>';
     }
@@ -2153,8 +2207,9 @@
         } else {
             $imgfile = $defaults->{$img};
         }
+        my $showfile;
         if ($imgfile) {
-            my ($showfile,$fullsize);
+            my $fullsize;
             if ($imgfile =~ m-^(/res/\Q$dom\E/\Q$confname\E/\Q$img\E)/([^/]+)$-) {
                 my $urldir = $1;
                 my $filename = $2;
@@ -2232,7 +2287,14 @@
             $datatable .= &mt('Upload to library server: [_1]',$switchserver);
         } else {
             if ($img ne 'login') { # suppress file selection for Log-in header
-                $datatable .=' <input type="file" name="'.$role.'_'.$img.'" />';
+                my $arialabel = &mt('Choose image file for [_1]',$choices->{$img});
+                if ($showfile) {
+                    $datatable .= '<div style="display: inline-block; margin: 4px 0 0 0;">';
+                }
+                $datatable .=' <input type="file" name="'.$role.'_'.$img.'" aria-label="'.$arialabel.'" />';
+                if ($showfile) {
+                    $datatable .= '</div>';
+                }
             }
         }
         if (($role eq 'login') && ($img ne 'login')) {
@@ -2249,27 +2311,34 @@
     my $bgs_def;
     foreach my $item (@{$bgs}) {
         if (!$is_custom->{$item}) {
-            $bgs_def .= '<td><span class="LC_nobreak">'.$choices->{$item}.'</span> <span class="css_default_'.$role.'_'.$item.'" style="background-color: '.$defaults->{'bgs'}{$item}.';">   </span><br />'.$defaults->{'bgs'}{$item}.'</td>';
+            $bgs_def .= '<div class="LC_grid_cell" role="gridcell" style="margin: 0;">'.
+                        '<span class="LC_nobreak">'.$choices->{$item}.'</span> '.
+			'<span class="css_default_'.$role.'_'.$item.'" style="background-color: '.$defaults->{'bgs'}{$item}.';">   </span><br />'.$defaults->{'bgs'}{$item}.'</div>';
         }
     }
     if ($bgs_def) {
-        $datatable .= '<td>'.&mt('Default(s) in use:').'<br /><table border="0"><tr>'.$bgs_def.'</tr></table></td>';
+        $datatable .= '<td>'.&mt('Default(s) in use:').'<br />'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">'.
+		      $bgs_def.
+		      '</div></div></td>';
     } else {
         $datatable .= '<td> </td>';
     }
     $datatable .= '<td class="LC_right_item">'.
-                  '<table border="0"><tr>';
-
+                  '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                  '<div class="LC_grid_row" role="row">';
     foreach my $item (@{$bgs}) {
-        $datatable .= '<td style="text-align: center">'.$choices->{$item};
+        $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                      '<label for="'.$role.'_'.$item.'">'.$choices->{$item}.'</label>';
 	my $color = $designs->{'bgs'}{$item} ? $designs->{'bgs'}{$item} : $defaults->{'bgs'}{$item};
         if ($designs->{'bgs'}{$item}) {
             $datatable .= ' ';
         }
         $datatable .= '<br /><input type="text" class="colorchooser" size="8" name="'.$role.'_'.$item.'" value="'.$color.
-                      '" onblur = "javascript:colchg_span('."'css_".$role.'_'.$item."'".',this);" /></td>';
+                      '" id="'.$role.'_'.$item.'" onblur = "javascript:colchg_span('."'css_".$role.'_'.$item."'".',this);" /></div>';
     }
-    $datatable .= '</tr></table></td></tr>';
+    $datatable .= '</div></div></td></tr>';
     $itemcount ++;
     $css_class = $itemcount%2?' class="LC_odd_row"':'';
     $datatable .= '<tr'.$css_class.'>'.
@@ -2277,25 +2346,66 @@
     my $links_def;
     foreach my $item (@{$links}) {
         if (!$is_custom->{$item}) {
-            $links_def .= '<td>'.$choices->{$item}.'<br /><span class="css_default_'.$role.'_'.$item.'" style="color: '.$defaults->{'links'}{$item}.';">'.$defaults->{'links'}{$item}.'</span></td>';
+            $links_def .= '<div class="LC_grid_cell" role="gridcell">'.$choices->{$item}.'<br /><span class="css_default_'.$role.'_'.$item.'" style="color: '.$defaults->{'links'}{$item}.';">'.$defaults->{'links'}{$item}.'</span></div>';
         }
     }
     if ($links_def) {
-        $datatable .= '<td>'.&mt('Default(s) in use:').'<br /><table border="0"><tr>'.$links_def.'</tr></table></td>';
+        $datatable .= '<td>'.&mt('Default(s) in use:').'<br />'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+		      '<div class="LC_grid_row" role="row">'.$links_def.'</div></div></td>';
     } else {
         $datatable .= '<td> </td>';
     }
     $datatable .= '<td class="LC_right_item">'.
-                  '<table border="0"><tr>';
+                  '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                  '<div class="LC_grid_row" role="row">';
     foreach my $item (@{$links}) {
 	my $color = $designs->{'links'}{$item} ? $designs->{'links'}{$item} : $defaults->{'links'}{$item};
-        $datatable .= '<td style="text-align: center">'.$choices->{$item}."\n";
+        $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                      '<label for="'.$role.'_'.$item.'">'.$choices->{$item}.'</label>'."\n";
         if ($designs->{'links'}{$item}) {
             $datatable.=' ';
         }
-        $datatable .= '<br /><input type="text" size="8" class="colorchooser" name="'.$role.'_'.$item.'" value="'.$color.
-                      '" /></td>';
+        $datatable .= '<br /><input type="text" size="8" class="colorchooser" name="'.$role.'_'.$item.'" id="'.$role.'_'.$item.'" value="'.$color.
+                      '" /></div>';
     }
+    $datatable .= '</div></div></td></tr>';
+    $itemcount ++;
+    $css_class = $itemcount%2?' class="LC_odd_row"':'';
+    unless ($role eq 'login') {
+        $datatable .= '<tr'.$css_class.'>'.
+                      '<td>'.$choices->{'alerts'}.'</td>';
+        my $alerts_def;
+        foreach my $item (@{$alerts}) {
+            if (!$is_custom->{$item}) {
+                $alerts_def .= '<div class="LC_grid_cell" role="gridcell">'.$choices->{$item}.'<br />'.
+                               '<span class="css_default_'.$role.'_'.$item.'" style="color: '.$defaults->{'alerts'}{$item}.';">'.
+                               $defaults->{'alerts'}{$item}.'</span></div>';
+            }
+        }
+        if ($alerts_def) {
+            $datatable .= '<td>'.&mt('Default(s) in use:').'<br />'.
+                          '<div class="LC_grid" role="grid" style="margin: 0;">'.
+		          '<div class="LC_grid_row" role="row">'.$alerts_def.'</div></div></td>';
+        } else {
+            $datatable .= '<td> </td>';
+        }
+        $datatable .= '<td class="LC_right_item">'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+		      '<div class="LC_grid_row" role="row">';
+        foreach my $item (@{$alerts}) {
+            my $color = $designs->{'alerts'}{$item} ? $designs->{'alerts'}{$item} : $defaults->{'alerts'}{$item};
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                          '<label for="'.$role.'_'.$item.'">'.$choices->{$item}.'</label>'."\n";
+            if ($designs->{'alerts'}{$item}) {
+                $datatable.=' ';
+            }
+            my $labeltext = &mt('[_1] color for [_2]',$choices->{'alerts'},$choices->{$item});
+            $datatable .= '<br /><input type="text" size="8" class="colorchooser" name="'.$role.'_'.$item.'" '.
+	                  'id="'.$role.'_'.$item.'" value="'.$color.'" aria-label="'.$labeltext.'" /></div>';
+        }
+    }
+    $itemcount ++;
     $$rowtotal += $itemcount;
     return $datatable;
 }
@@ -2348,14 +2458,14 @@
 
 sub login_text_colors {
     my ($img,$role,$logintext,$phase,$choices,$designs,$defaults) = @_;
-    my $color_menu = '<table border="0"><tr>';
+    my $color_menu = '<div class="LC_grid" role="grid"><div class="LC_grid_row" role="row">';
     foreach my $item (@{$logintext}) {
-        $color_menu .= '<td style="text-align: center">'.$choices->{$item};
+        $color_menu .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center"><label>'.$choices->{$item};
         my $color = $designs->{'logintext'}{$item} ? $designs->{'logintext'}{$item} : $defaults->{'logintext'}{$item};
         $color_menu .= '<br /><input type="text" class="colorchooser" size="8" name="'.$role.'_'.$item.'" value="'.$color.
-                      '" onblur = "javascript:colchg_span('."'css_".$role.'_'.$item."'".',this);" /></td>';
+                      '" onblur = "javascript:colchg_span('."'css_".$role.'_'.$item."'".',this);" /></label></div>';
     }
-    $color_menu .= '</tr></table><br />';
+    $color_menu .= '</div></div><br />';
     return $color_menu;
 }
 
@@ -2435,6 +2545,15 @@
                               '<td class="LC_left_item">';
                 if ($context eq 'requestcourses') {
                     $datatable .= '<table><tr>';
+                } else {
+                    my $legend;
+                    if ($context eq 'requestauthor') {
+                        $legend = &mt('Handling authoring requests from [_1]',$usertypes->{$type});
+                    } else {
+                        $legend = &mt('Tools available for [_1]',$usertypes->{$type});
+                    }
+                    $datatable .= '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                                  '<legend class="LC_visually_hidden">'.$legend.'</legend>';
                 }
                 my %cell;  
                 foreach my $item (@usertools) {
@@ -2444,7 +2563,7 @@
                             if (ref($settings->{$item}) eq 'HASH') {
                                 $curroption = $settings->{$item}->{$type};
                                 if ($curroption =~ /^autolimit=(\d*)$/) {
-                                    $currlimit = $1; 
+                                    $currlimit = $1;
                                 }
                             }
                         }
@@ -2452,6 +2571,10 @@
                             $curroption = 'norequest';
                         }
                         $datatable .= '<th>'.$titles{$item}.'</th>';
+                        my $legend = &mt('Request for course type [_1] by user type: [_2]',
+			                 $titles{$item},$usertypes->{$type});
+			$cell{$item} = '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                                       '<legend class="LC_visually_hidden">'.$legend.'</legend>';
                         foreach my $option (@options) {
                             my $val = $option;
                             if ($option eq 'norequest') {
@@ -2479,15 +2602,18 @@
                                   '_'.$type.'" value="'.$val.'"'.$checked.' />'.
                                   $titles{$option}.'</label>';
                             if ($option eq 'autolimit') {
+                                my $arialabel = &mt('Total course requests (type: [_1]) per user ([_2])',
+                                                    $titles{$item},$usertypes->{$type});
                                 $cell{$item} .= ' <input type="text" name="crsreq_'.
                                                 $item.'_limit_'.$type.'" size="1" '.
-                                                'value="'.$currlimit.'" />';
+                                                'value="'.$currlimit.'" aria-label="'.$arialabel.'" />';
                             }
                             $cell{$item} .= '</span> ';
                             if ($option eq 'autolimit') {
                                 $cell{$item} .= $titles{'unlimited'};
                             }
                         }
+                        $cell{$item} .= '</fieldset>';
                     } elsif ($context eq 'requestauthor') {
                         my $curroption;
                         if (ref($settings) eq 'HASH') {
@@ -2536,16 +2662,19 @@
                         $datatable .= '<td style="vertical-align: top">'.$cell{$item}.'</td>';  
                     }
                     $datatable .= '</tr></table>';
+                } else {
+                    $datatable .= '</fieldset>';
                 }
                 $datatable .= '</td>';
                 unless (($context eq 'requestcourses') ||
                         ($context eq 'requestauthor')) {
+                    my $labeltext = &mt('Quota for [_1]',$usertypes->{$type});
                     $datatable .= 
                               '<td class="LC_right_item">'.
                               '<span class="LC_nobreak">'.
                               '<input type="text" name="quota_'.$type.
                               '" value="'.$currdefquota.
-                              '" size="5" /></span></td>';
+                              '" size="5" aria-label="'.$labeltext.'" /></span></td>';
                 }
                 $datatable .= '</tr>';
             }
@@ -2568,6 +2697,15 @@
                   '<td class="LC_left_item">';
     if ($context eq 'requestcourses') {
         $datatable .= '<table><tr>';
+    } else {
+        my $legend;
+        if ($context eq 'requestauthor') {
+            $legend = &mt('Handling authoring requests from [_1]',$othertitle);
+        } else {
+            $legend = &mt('Tools available for [_1]',$othertitle);
+        }
+        $datatable .= '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                      '<legend class="LC_visually_hidden">'.$legend.'</legend>';
     }
     my %defcell;
     foreach my $item (@usertools) {
@@ -2585,6 +2723,10 @@
                 $curroption = 'norequest';
             }
             $datatable .= '<th>'.$titles{$item}.'</th>';
+            my $legend = &mt('Request for course type [_1] by user type: [_2]',
+                             $titles{$item},$othertitle);
+            $defcell{$item} = '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                              '<legend class="LC_visually_hidden">'.$legend.'</legend>';
             foreach my $option (@options) {
                 my $val = $option;
                 if ($option eq 'norequest') {
@@ -2612,15 +2754,18 @@
                                   '_default" value="'.$val.'"'.$checked.' />'.
                                   $titles{$option}.'</label>';
                 if ($option eq 'autolimit') {
+                    my $arialabel = &mt('Total course requests (type: [_1]) per user ([_2])',
+                                        $titles{$item},$othertitle);
                     $defcell{$item} .= ' <input type="text" name="crsreq_'.
                                        $item.'_limit_default" size="1" '.
-                                       'value="'.$currlimit.'" />';
+                                       'value="'.$currlimit.'" aria-label="'.$arialabel.'" />';
                 }
                 $defcell{$item} .= '</span> ';
                 if ($option eq 'autolimit') {
                     $defcell{$item} .= $titles{'unlimited'};
                 }
             }
+            $defcell{$item} .= '</fieldset>';
         } elsif ($context eq 'requestauthor') {
             my $curroption;
             if (ref($settings) eq 'HASH') {
@@ -2669,13 +2814,16 @@
             $datatable .= '<td style="vertical-align: top">'.$defcell{$item}.'</td>';
         }
         $datatable .= '</tr></table>';
+    } else {
+        $datatable .= '</fieldset>';
     }
     $datatable .= '</td>';
     unless (($context eq 'requestcourses') || ($context eq 'requestauthor')) {
+        my $labeltext = &mt('Quota for [_1]',$othertitle);
         $datatable .= '<td class="LC_right_item">'.
                       '<span class="LC_nobreak">'.
                       '<input type="text" name="defaultquota" value="'.
-                      $defaultquota.'" size="5" /></span></td>';
+                      $defaultquota.'" size="5" aria-label="'.$labeltext.'" /></span></td>';
     }
     $datatable .= '</tr>';
     $typecount ++;
@@ -2692,6 +2840,14 @@
                       '</td>'.
                       '<td class="LC_left_item" colspan="2">'.
                       '<br />';
+        my $legend;
+        if ($context eq 'requestauthor') {
+            $legend = &mt('Handling authoring requests from LON-CAPA Advanced Users');
+        } else {
+            $legend = &mt('Tools available for LON-CAPA Advanced Users');
+        }
+        $datatable .= '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                      '<legend class="LC_visually_hidden">'.$legend.'</legend>'; 
     }
     my %advcell;
     foreach my $item (@usertools) {
@@ -2706,6 +2862,10 @@
                 }
             }
             $datatable .= '<th>'.$titles{$item}.'</th>';
+            my $legend = &mt('Request for course type [_1] (advanced user override)',
+                             $titles{$item});
+            $advcell{$item} = '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                              '<legend class="LC_visually_hidden">'.$legend.'</legend>';
             my $checked = '';
             if ($curroption eq '') {
                 $checked = ' checked="checked"';
@@ -2741,15 +2901,18 @@
                                   '__LC_adv" value="'.$val.'"'.$checked.' />'.
                                   $titles{$option}.'</label>';
                 if ($option eq 'autolimit') {
+                    my $arialabel = &mt('Total course requests (type: [_1]) per user (advanced user override)',
+                                        $titles{$item});
                     $advcell{$item} .= ' <input type="text" name="crsreq_'.
                                        $item.'_limit__LC_adv" size="1" '.
-                                       'value="'.$currlimit.'" />';
+                                       'value="'.$currlimit.'" aria-label="'.$arialabel.'" />';
                 }
                 $advcell{$item} .= '</span> ';
                 if ($option eq 'autolimit') {
                     $advcell{$item} .= $titles{'unlimited'};
                 }
             }
+            $advcell{$item} .= '</fieldset>';
         } elsif ($context eq 'requestauthor') {
             my $curroption;
             if (ref($settings) eq 'HASH') {
@@ -2803,6 +2966,8 @@
             $datatable .= '<td style="vertical-align: top">'.$advcell{$item}.'</td>';
         }
         $datatable .= '</tr></table>';
+    } else {
+        $datatable .= '</fieldset>';
     }
     $datatable .= '</td></tr>';
     $$rowtotal += $typecount;
@@ -2844,10 +3009,10 @@
        $text = &mt('Receive notification of queued requests for self-created user accounts requiring approval');
     }
     $datatable = '<tr'.$css_class.'>'.
-                 ' <td>'.$text.'</td>'.
-                 ' <td class="LC_left_item">';
+                 '<td>'.$text.'</td>'.
+                 '<td class="LC_left_item">';
     my ($numdc,$table,$rows) = &active_dc_picker($dom,$numinrow,'checkbox',
-                                                 $action.'notifyapproval',%currapp);
+                                                 $action.'notifyapproval',$text,%currapp);
     if ($numdc > 0) {
         $datatable .= $table;
     } else {
@@ -2869,9 +3034,13 @@
             }
         }
     }
-    $output .= '<tr>'.
-               '<td class="LC_left_item">'.&mt('Generate unique six character code as course identifier?').'</td>'.
-               '<td class="LC_left_item">';
+    my $title = &mt('Generate unique six character code as course identifier?');
+    my $css_class = $$rowtotal%2?' class="LC_odd_row"':'';
+    $output .= '<tr'.$css_class.'>'.
+               '<td class="LC_left_item">'.$title.'</td>'.
+               '<td class="LC_left_item">'.
+               '<fieldset class="LC_borderless">'.
+               '<legend class="LC_visually_hidden">'.$title.'</legend>';
     foreach my $type (@crstypes) {
         my $check = ' ';
         if ($current{$type}) {
@@ -2881,7 +3050,7 @@
                    '<input type="checkbox" name="uniquecode" value="'.$type.'"'.$check.'/>'.
                    &mt($type).'</label></span>'.(' 'x2).' ';
     }
-    $output .= '</td></tr>';
+    $output .= '</fieldset></td></tr>';
     $$rowtotal ++;
     return $output;
 }
@@ -2945,15 +3114,15 @@
             $datatable .= '</select>'.(' 'x2).
                 '<label><input type="checkbox" name="'.$type.'_del" value="'.$key.'" />'.
                 &mt('Delete?').'</label></span></td>'.
-                '<td colspan="2">'.
-                '<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_subject_'.$i.'" value="'.$subject.'" /></span> '.
+                '<td colspan="2" style="line-height: 200%;">'.
+                '<span class="LC_nobreak"><label>'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_subject_'.$i.'" value="'.$subject.'" /></label></span> '.
                 (' 'x2).
-                '<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_title_'.$i.'" value="'.$title.'" /></span> ';
+                '<span class="LC_nobreak"><label>'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_title_'.$i.'" value="'.$title.'" /></label></span> ';
             if ($type eq 'textbooks') {
                 $datatable .= (' 'x2).
-                              '<span class="LC_nobreak">'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_publisher_'.$i.'" value="'.$publisher.'" /></span> '.
+                              '<span class="LC_nobreak"><label>'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_publisher_'.$i.'" value="'.$publisher.'" /></label></span> '.
                               (' 'x2).
-                              '<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_author_'.$i.'" value="'.$author.'" /></span> '.
+                              '<span class="LC_nobreak"><label>'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_author_'.$i.'" value="'.$author.'" /></label></span> '.
                               (' 'x2).
                               '<span class="LC_nobreak">'.&mt('Thumbnail:');
                 if ($image) {
@@ -2965,7 +3134,8 @@
                 if ($switchserver) {
                     $datatable .= &mt('Upload to library server: [_1]',$switchserver);
                 } else {
-                    $datatable .= '<input type="file" name="'.$type.'_image_'.$i.'" value="" />';
+                    my $arialabel = &mt('Select image file to upload'); 
+                    $datatable .= '<input type="file" name="'.$type.'_image_'.$i.'" value="" aria-label="'.$arialabel.'" />';
                 }
             }
             $datatable .= '<input type="hidden" name="'.$type.'_id_'.$i.'" value="'.$type.'_'.$key.'" /></span> '.
@@ -2976,9 +3146,10 @@
     }
     $css_class = $itemcount%2?' class="LC_odd_row"':'';
     my $chgstr = ' onchange="javascript:reorderBooks(this.form,'."'$type"."_addbook_pos','$type'".');"';
-    $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n".
+    my $labeltext = &mt('Set list order -- type: [_1]',$type);
+    $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'."\n".
                   '<input type="hidden" name="'.$type.'_maxnum" value="'.$maxnum.'" />'."\n".
-                  '<select name="'.$type.'_addbook_pos"'.$chgstr.'>';
+                  '<select name="'.$type.'_addbook_pos"'.$chgstr.' aria-label="'.$labeltext.'">';
     for (my $k=0; $k<$maxnum+1; $k++) {
         my $vpos = $k+1;
         my $selstr;
@@ -2988,30 +3159,32 @@
         $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
     }
     $datatable .= '</select> '."\n".
-                  '<input type="checkbox" name="'.$type.'_addbook" value="1" />'.&mt('Add').'</span></td>'."\n".
-                  '<td colspan="2">'.
-                  '<span class="LC_nobreak">'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_addbook_subject" value="" /></span> '."\n".
+                  '<label><input type="checkbox" name="'.$type.'_addbook" value="1" />'.&mt('Add').'</label></span></td>'."\n".
+                  '<td colspan="2" style="line-height: 200%;">'.
+                  '<span class="LC_nobreak"><label>'.&mt('Subject:').'<input type="text" size="15" name="'.$type.'_addbook_subject" value="" /></label></span> '."\n".
                   (' 'x2).
-                  '<span class="LC_nobreak">'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_addbook_title" value="" /></span> '."\n".
+                  '<span class="LC_nobreak"><label>'.&mt('Title:').'<input type="text" size="30" name="'.$type.'_addbook_title" value="" /></label></span> '."\n".
                   (' 'x2);
     if ($type eq 'textbooks') {
-        $datatable .= '<span class="LC_nobreak">'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_addbook_publisher" value="" /></span> '."\n".
+        $datatable .= '<span class="LC_nobreak"><label>'.&mt('Publisher:').'<input type="text" size="10" name="'.$type.'_addbook_publisher" value="" /></label></span> '."\n".
                       (' 'x2).
-                      '<span class="LC_nobreak">'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_addbook_author" value="" /></span> '."\n".
+                      '<span class="LC_nobreak"><label>'.&mt('Author(s):').'<input type="text" size="25" name="'.$type.'_addbook_author" value="" /></label></span> '."\n".
                       (' 'x2).
                       '<span class="LC_nobreak">'.&mt('Image:').' ';
         if ($switchserver) {
             $datatable .= &mt('Upload to library server: [_1]',$switchserver);
         } else {
-            $datatable .= '<input type="file" name="'.$type.'_addbook_image" value="" />';
+            my $arialabel = &mt('Select image file to upload');
+            $datatable .= '<input type="file" name="'.$type.'_addbook_image" value="" aria-label="'.$arialabel.'" />';
         }
         $datatable .= '</span>'."\n";
     }
-    $datatable .= '<span class="LC_nobreak">'.&mt('LON-CAPA course:').' '.
-                  &Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom').
-                  '<input type="text" size="25" name="'.$type.'_addbook_cnum" value="" />'.
+    $datatable .= '<span class="LC_nobreak"><label for="'.$type.'_addbook_cnum">'.&mt('LON-CAPA course').'</label> '.
+                  '<span class="LC_visually_hidden"><label for="'.$type.'_addbook_cdom">'.&mt('(in domain)').'</label></span>:'.
+                  &Apache::loncommon::select_dom_form($env{'request.role.domain'},$type.'_addbook_cdom','','','','','','',$type.'_addbook_cdom').
+                  '<input type="text" size="25" name="'.$type.'_addbook_cnum" id="'.$type.'_addbook_cnum" value="" />'.
                   &Apache::loncommon::selectcourse_link
-                      ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course').
+                      ('display',$type.'_addbook_cnum',$type.'_addbook_cdom',undef,undef,undef,'Course','','',$type.'_addbook_cnum').
                   '</span></td>'."\n".
                   '</tr>'."\n";
     $itemcount ++;
@@ -4037,43 +4210,60 @@
             $runon = ' ';
         }
     }
-    my $domform = &Apache::loncommon::select_dom_form($defdom,'sender_domain',1);
+    my $domform = &Apache::loncommon::select_dom_form($defdom,'sender_domain',1,
+                                                      '','','','','','sender_domain');
     my $notif_sender;
     if (ref($settings) eq 'HASH') {
         $notif_sender = $settings->{'sender_uname'};
     }
+    my %lt = &Apache::lonlocal::texthash(
+        act => 'Auto-enrollment active?',
+        not => 'Notification messages - sender',
+        aco => 'Automatically assign co-ownership',
+        fai => 'Failsafe for no drops when institutional data missing',
+        thr => 'Threshold for number of students in section to drop'
+    );
     my $datatable='<tr class="LC_odd_row">'.
-                  '<td>'.&mt('Auto-enrollment active?').'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  '<td style="line-height: 170%;">'.$lt{'act'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$lt{'act'}.'</legend>'.
+                  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="autoenroll_run"'.
                   $runon.' value="1" />'.&mt('Yes').'</label> '.
                   '<label><input type="radio" name="autoenroll_run"'.
-                  $runoff.' value="0" />'.&mt('No').'</label></span></td>'.
+                  $runoff.' value="0" />'.&mt('No').'</label></span>'.
+                  '</fieldset></td>'.
                   '</tr><tr>'.
-                  '<td>'.&mt('Notification messages - sender').
-                  '</td><td class="LC_right_item"><span class="LC_nobreak">'.
+                  '<td style="line-height: 170%;">'.$lt{'not'}.'</td>'.
+                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
                   &mt('username').': '.
                   '<input type="text" name="sender_uname" value="'.
-                  $notif_sender.'" size="10" />  '.&mt('domain').
+                  $notif_sender.'" size="10" /></label>  '.
+                  '<label for="sender_domain">'.&mt('domain').'</label>'.
                   ': '.$domform.'</span></td></tr>'.
                   '<tr class="LC_odd_row">'.
-                  '<td>'.&mt('Automatically assign co-ownership').'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  '<td style="line-height: 170%;">'.$lt{'aco'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$lt{'aco'}.'</legend>'.
+		  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="autoassign_coowners"'.
                   $coownerson.' value="1" />'.&mt('Yes').'</label> '.
                   '<label><input type="radio" name="autoassign_coowners"'.
-                  $coownersoff.' value="0" />'.&mt('No').'</label></span></td>'.
-                  '</tr><tr>'.
-                  '<td>'.&mt('Failsafe for no drops when institutional data missing').'</td>'.
-                  '<td class="LC_left_item"><span class="LC_nobreak">'.
+                  $coownersoff.' value="0" />'.&mt('No').'</label></span>'.
+                  '</fieldset></td></tr>'.
+                  '<tr><td>'.$lt{'fai'}.'</td>'.
+                  '<td class="LC_left_item">'.
+		  '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                  '<legend class="LC_visually_hidden">'.$lt{'fai'}.'</legend>'.
                   '<span class="LC_nobreak"><label><input type="radio" name="autoenroll_failsafe" value="off" onclick="toggleFailsafe(this.form)"'.$failsafechecked{'off'}.' />'.&mt('Not in use').'</label></span>    '.
                   '<span class="LC_nobreak"><label><input type="radio" name="autoenroll_failsafe" value="zero" onclick="toggleFailsafe(this.form)"'.$failsafechecked{'zero'}.' />'.&mt('Retrieved section enrollment is zero').'</label></span><br />'.
                   '<span class="LC_nobreak"><label><input type="radio" name="autoenroll_failsafe" value="any" onclick="toggleFailsafe(this.form)"'.$failsafechecked{'any'}.' />'.&mt('Retrieved section enrollment is zero or greater').'</label></span>'.
                   '<div class="LC_floatleft" style="display:'.$failsafesty.';" id="autoenroll_failsafe_div">'.
-                  '<span class="LC_nobreak">'.
-                  &mt('Threshold for number of students in section to drop: [_1]',
-                      '<input type="text" name="autoenroll_autofailsafe" value="'.$autofailsafe.'" size="4" />').
-                  '</span></div></td></tr>';
+                  '<span class="LC_nobreak"><label>'.$lt{'thr'}.': '.
+                  '<input type="text" name="autoenroll_autofailsafe" value="'.$autofailsafe.'" size="4" />'.
+                  '</label></span></div></fieldset></td></tr>';
     $$rowtotal += 4;
     return $datatable;
 }
@@ -4098,12 +4288,15 @@
             }
         }
         $enable = '<tr class="LC_odd_row">'.
-                  '<td>'.$choices{'run'}.'</td>'.
-                  '<td class="LC_left_item"><span class="LC_nobreak"><label>'.
+                  '<td style="line-height: 170%;">'.$choices{'run'}.'</td>'.
+                  '<td class="LC_left_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$choices{'run'}.'</legend>'.
+                  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="autoupdate_run"'.
                   $updateoff.'value="0" />'.&mt('No').'</label> '.
                   '<label><input type="radio" name="autoupdate_run"'.
-                  $updateon.'value="1" />'.&mt('Yes').'</label></span></td>'.
+                  $updateon.'value="1" />'.&mt('Yes').'</label></span></fieldset></td>'.
                   '</tr>';
         my @toggles = ('classlists','unexpired');
         my %defaultchecked = ('classlists' => 'off',
@@ -4129,18 +4322,22 @@
         }
         my $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'>'.
-                      '<td>'.$choices{'lastactive'}.'</td>'.
-                      '<td class="LC_left_item"><span class="LC_nobreak"><label>'.
+                      '<td style="line-height: 170%;">'.$choices{'lastactive'}.'</td>'.
+                      '<td class="LC_left_item">'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$choices{'lastactive'}.'</legend>'.
+                      '<span class="LC_nobreak"><label>'.
                       '<input type="radio" name="lastactive"'.
                       $lastactiveoff.'value="0"'.$onclick.' />'.&mt('No').'</label>'.
-                      ' <label>'.
+                      ' </span><label>'.
                       '<input type="radio" name="lastactive"'.
                       $lastactiveon.' value="1"'.$onclick.' />'.&mt('Yes').'</label>'.
                       '<div id="lastactive_div" style="display:'.$lastactivestyle.';">'.
+                      '<span class="LC_nobreak">'.
                       ': '.&mt('inactive = no activity in last [_1] days',
                           '<input type="text" size="5" name="lastactivedays" value="'.
-                          $lastactivedays.'" />').
-                      '</span></td>'.
+                          $lastactivedays.'" aria-label="'.&mt('threshold for inactivity (days)').'" />').
+                      '</span></div></fieldset></td>'.
                       '</tr>';
         $$rowtotal ++;
     } elsif ($position eq 'middle') {
@@ -4200,22 +4397,32 @@
     }
     $$rowtotal += 2;
     my $numinrow = 2;
+    my %lt = &Apache::lonlocal::texthash(
+                 crxm => 'Create pending official courses from XML files',
+                 crof => 'Create pending requests for official courses (if validated)',
+    );       
     my $datatable='<tr class="LC_odd_row">'.
-                  '<td>'.&mt('Create pending official courses from XML files').'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  '<td style="line-height: 170%;">'.$lt{'crxm'}.'</td>'.
+                  '<td class="LC_right_item"><fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$lt{'crxm'}.'</legend>'.
+                  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="autocreate_xml"'.
                   $createon{'xml'}.' value="1" />'.&mt('Yes').'</label> '.
                   '<label><input type="radio" name="autocreate_xml"'.
                   $createoff{'xml'}.' value="0" />'.&mt('No').'</label></span>'.
-                  '</td></tr><tr>'.
-                  '<td>'.&mt('Create pending requests for official courses (if validated)').'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  '</fieldset></td></tr><tr>'.
+                  '<td style="line-height: 170%;">'.$lt{'crof'}.'</td>'.
+                  '<td class="LC_right_item"><fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$lt{'crof'}.'</legend>'.
+                  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="autocreate_req"'.
                   $createon{'req'}.' value="1" />'.&mt('Yes').'</label> '.
                   '<label><input type="radio" name="autocreate_req"'.
-                  $createoff{'req'}.' value="0" />'.&mt('No').'</label></span>';
+                  $createoff{'req'}.' value="0" />'.&mt('No').'</label></span>'.
+                  '</fieldset>';
+    my $legend = &mt('Choose Dom. Coord. who will be listed as course creator');
     my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',
-                                                   'autocreate_xmldc',%currhash);
+                                                   'autocreate_xmldc',$legend,%currhash);
     $datatable .= '</td></tr><tr class="LC_odd_row"><td>';
     if ($numdc > 1) {
         $datatable .= &mt('Course creation processed as: (choose Dom. Coord.)').
@@ -4273,20 +4480,34 @@
 
         my $numinrow = 4;
         my $cansrchrow = 0;
+        my %lt = &Apache::lonlocal::texthash(
+                     indi => 'Institutional directory search available?',
+                     othe => 'Other domains can search institution?',
+                     supp => 'Supported search methods',
+                     lati => 'Search latitude',
+        );
         $datatable='<tr class="LC_odd_row">'.
-                   '<td colspan="2"><span class ="LC_nobreak">'.&mt('Institutional directory search available?').'</span></td>'.
-                   '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                   '<td colspan="2" style="line-height: 170%;">'.
+                   '<span class ="LC_nobreak">'.$lt{'indi'}.'</span></td>'.
+                   '<td class="LC_right_item">'.
+                   '<fieldset class="LC_borderless">'.
+                   '<legend class="LC_visually_hidden">'.$lt{'indi'}.'</legend>'.
+                   '<span class="LC_nobreak"><label>'.
                    '<input type="radio" name="dirsrch_available"'.
                    $instsrchon.' value="1" />'.&mt('Yes').'</label> '.
                    '<label><input type="radio" name="dirsrch_available"'.
-                   $instsrchoff.' value="0" />'.&mt('No').'</label></span></td>'.
+                   $instsrchoff.' value="0" />'.&mt('No').'</label></span></fieldset></td>'.
                    '</tr><tr>'.
-                   '<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search institution?').'</span></td>'.
-                   '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                   '<td colspan="2" style="line-height: 170%;">'.
+                   '<span class ="LC_nobreak">'.$lt{'othe'}.'</span></td>'.
+                   '<td class="LC_right_item">'.
+                   '<fieldset class="LC_borderless">'.
+                   '<legend class="LC_visually_hidden">'.$lt{'othe'}.'</legend>'.
+                   '<span class="LC_nobreak"><label>'.
                    '<input type="radio" name="dirsrch_instlocalonly"'.
                    $instlocaloff.' value="0" />'.&mt('Yes').'</label> '.
                    '<label><input type="radio" name="dirsrch_instlocalonly"'.
-                   $instlocalon.' value="1" />'.&mt('No').'</label></span></td>'.
+                   $instlocalon.' value="1" />'.&mt('No').'</label></span></fieldset></td>'.
                    '</tr>';
         $$rowtotal += 2;
         if (ref($usertypes) eq 'HASH') {
@@ -4303,8 +4524,12 @@
         } else {
             $datatable .= '<tr class="LC_odd_row">';
         }
-        $datatable .= '<td><span class ="LC_nobreak">'.&mt('Supported search methods').
-                      '</span></td><td class="LC_left_item" colspan="2"><table><tr>';
+        $datatable .= '<td><span class ="LC_nobreak">'.$lt{'supp'}.'</span></td>'.
+                      '<td class="LC_left_item" colspan="2">'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$lt{'supp'}.'</legend>'.
+                      '<div class="LC_grid" role="grid">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $title (@{$titleorder}) {
             if (defined($searchtitles->{$title})) {
                 my $check = ' ';
@@ -4315,22 +4540,25 @@
                         }
                     }
                 }
-                $datatable .= '<td class="LC_left_item">'.
+                $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
                               '<span class="LC_nobreak"><label>'.
                               '<input type="checkbox" name="searchby" '.
                               'value="'.$title.'"'.$check.'/>'.
-                              $searchtitles->{$title}.'</label></span></td>';
+                              $searchtitles->{$title}.'</label></span></div>';
             }
         }
-        $datatable .= '</tr></table></td></tr>';
+        $datatable .= '</div></div></fieldset></td></tr>';
         $$rowtotal ++;
         if ($cansrchrow) {
             $datatable .= '<tr class="LC_odd_row">';
         } else {
             $datatable .= '<tr>';
         }
-        $datatable .= '<td><span class ="LC_nobreak">'.&mt('Search latitude').'</span></td>'.   
+        $datatable .= '<td style="line-height: 170%;">'.
+                      '<span class="LC_nobreak">'.$lt{'lati'}.'</span></td>'.   
                       '<td class="LC_left_item" colspan="2">'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$lt{'lati'}.'</legend>'.
                       '<span class="LC_nobreak"><label>'.
                       '<input type="checkbox" name="searchtypes" '.
                       $exacton.' value="exact" />'.&mt('Exact match').
@@ -4340,13 +4568,17 @@
                       '</label> '.
                       '<label><input type="checkbox" name="searchtypes" '.
                       $containson.' value="contains" />'.&mt('Contains').
-                      '</label></span></td></tr>';
+                      '</label></span></fieldset></td></tr>';
         $$rowtotal ++;
     } else {
         my $domsrchon = ' checked="checked" ';
         my $domsrchoff = ' ';
         my $domlocalon = ' ';
         my $domlocaloff = ' checked="checked" ';
+        my %lt = &Apache::lonlocal::texthash(
+                     lcdi => 'LON-CAPA directory search available',
+                     olcd => 'Other domains can search LON-CAPA domain?',
+        );
         if (ref($settings) eq 'HASH') {
             if ($settings->{'lclocalonly'} eq '1') {
                 $domlocalon = $domlocaloff;
@@ -4358,19 +4590,25 @@
             }
         }
         $datatable='<tr class="LC_odd_row">'.
-                      '<td colspan="2"><span class ="LC_nobreak">'.&mt('LON-CAPA directory search available?').'</span></td>'.
-                      '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                      '<td colspan="2"><span class ="LC_nobreak">'.$lt{'lcdi'}.'</span></td>'.
+                      '<td class="LC_right_item">'.
+                      '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                      '<legend class="LC_visually_hidden">'.$lt{'lcdi'}.'</legend>'.
+                      '<span class="LC_nobreak"><label>'.
                       '<input type="radio" name="dirsrch_domavailable"'.
                       $domsrchon.' value="1" />'.&mt('Yes').'</label> '.
                       '<label><input type="radio" name="dirsrch_domavailable"'.
-                      $domsrchoff.' value="0" />'.&mt('No').'</label></span></td>'.
+                      $domsrchoff.' value="0" />'.&mt('No').'</label></span></fieldset></td>'.
                       '</tr><tr>'.
-                      '<td colspan="2"><span class ="LC_nobreak">'.&mt('Other domains can search LON-CAPA domain?').'</span></td>'.
-                      '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                      '<td colspan="2"><span class ="LC_nobreak">'.$lt{'olcd'}.'</span></td>'.
+                      '<td class="LC_right_item">'.
+                      '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                      '<legend class="LC_visually_hidden">'.$lt{'olcd'}.'</legend>'.
+                      '<span class="LC_nobreak"><label>'.
                       '<input type="radio" name="dirsrch_domlocalonly"'.
                       $domlocaloff.' value="0" />'.&mt('Yes').'</label> '.
                       '<label><input type="radio" name="dirsrch_domlocalonly"'.
-                      $domlocalon.' value="1" />'.&mt('No').'</label></span></td>'.
+                      $domlocalon.' value="1" />'.&mt('No').'</label></span></fieldset></td>'.
                       '</tr>';
         $$rowtotal += 2;
     }
@@ -4495,9 +4733,9 @@
         foreach my $item (@contacts) {
             $css_class = $rownum%2?' class="LC_odd_row"':'';
             $datatable .= '<tr'.$css_class.'>'. 
-                          '<td><span class="LC_nobreak">'.$titles->{$item}.
+                          '<td><span class="LC_nobreak"><label for="'.$item.'">'.$titles->{$item}.'</label>'.
                           '</span></td><td class="LC_right_item">'.
-                          '<input type="text" name="'.$item.'" value="'.
+                          '<input type="text" name="'.$item.'" id="'.$item.'" value="'.
                           $to{$item}.'" /></td></tr>';
             $rownum ++;
         }
@@ -4511,16 +4749,23 @@
             (ref($fieldoptions) eq 'HASH') && (ref($possoptions) eq 'HASH')) {
             $datatable .= '<table><tr><th>'.&mt('Field').'</th><th>'.&mt('Status').'</th></tr>';
             foreach my $field (@{$fields}) {
-                $datatable .= '<tr><td>'.$fieldtitles->{$field};
+                $datatable .= '<tr><td><span aria-hidden="true" style="line-height: 170%;">'.
+                              $fieldtitles->{$field};
                 if (($field eq 'screenshot') || ($field eq 'cc')) {
                     $datatable .= ' '.&mt('(logged-in users)');
                 }
-                $datatable .='</td><td>';
+                $datatable .='</span></td><td>';
                 my $clickaction;
                 if ($field eq 'screenshot') {
                     $clickaction = ' onclick="screenshotSize(this);"';
                 }
                 if (ref($possoptions->{$field}) eq 'ARRAY') {
+                    $datatable .= '<fieldset class="LC_borderless">'.
+                                  '<legend class="LC_visually_hidden">'.$fieldtitles->{$field};
+                    if (($field eq 'screenshot') || ($field eq 'cc')) {
+                        $datatable .= ' '.&mt('(logged-in users)');
+                    }
+                    $datatable .= '</legend>';
                     foreach my $option (@{$possoptions->{$field}}) {
                         my $checked;
                         if ($currfield{$field} eq $option) {
@@ -4531,15 +4776,16 @@
                                       'value="'.$option.'"'.$checked.$clickaction.' />'.$fieldoptions->{$option}.
                                       '</label></span>'.(' 'x2);
                     }
+                    $datatable .= '</fieldset>';
                 }
                 if ($field eq 'screenshot') {
                     my $display;
                     if ($currfield{$field} eq 'no') {
-                        $display = ' style="display:none"';
+                        $display = ' style="display: none;"';
                     }
                     $datatable .= '</td></tr><tr id="help_screenshotsize"'.$display.'>'.
-                                  '<td>'.&mt('Maximum size for upload (MB)').'</td><td>'.
-                                  '<input type="text" size="5" name="helpform_maxsize" value="'.$maxsize.'" />';
+                                  '<td><label for="helpform_maxsize">'.&mt('Maximum size for upload (MB)').'</label></td><td>'.
+                                  '<input type="text" size="5" name="helpform_maxsize" id="helpform_maxsize" value="'.$maxsize.'" />';
                 }
                 $datatable .= '</td></tr>';
             }
@@ -4557,6 +4803,9 @@
                           '<td class="LC_left_item">';
             if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) {
                 $datatable .= '<fieldset><legend>'.&mt('E-mail recipient(s)').'</legend>';
+            } else {
+                $datatable .= '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                              '<legend class="LC_visually_hidden">'.$titles->{$type}.'</legend>';
             }
             $datatable .= '<span class="LC_nobreak">';
             foreach my $item (@contacts) {
@@ -4566,9 +4815,10 @@
                               ' value="'.$item.'" />'.$short_titles->{$item}.
                               '</label> ';
             }
-            $datatable .= '</span><br />'.&mt('Others').':  '.
+            $datatable .= '</span><br /><div style="margin: 4px 0 4px 0; padding: 0;">'.
+                          '<label>'.&mt('Others').':  '.
                           '<input type="text" name="'.$type.'_others" '.
-                          'value="'.$otheremails{$type}.'"  />';
+                          'value="'.$otheremails{$type}.'"  /></label>';
             my %locchecked;
             if (($type eq 'helpdeskmail') || ($type eq 'otherdomsmail')) {
                 foreach my $loc ('s','b') {
@@ -4577,17 +4827,20 @@
                         last;
                     }
                 }
-                $datatable .= '<br />'.&mt('Bcc:').(' 'x6).
-                              '<input type="text" name="'.$type.'_bcc" '.
-                              'value="'.$bccemails{$type}.'"  /></fieldset>'.
+                $datatable .= '</div><div style="margin: 4px 0 4px 0; padding: 0;">'.
+                              '<label for="'.$type.'_bcc">'.&mt('Bcc:').'</label>'.(' 'x6).
+                              '<input type="text" name="'.$type.'_bcc" id="'.$type.'_bcc" '.
+                              'value="'.$bccemails{$type}.'"  /></div></fieldset>'.
                               '<fieldset><legend>'.&mt('Optional added text').'</legend>'.
-                              &mt('Text automatically added to e-mail:').' '.
-                              '<input type="text" name="'.$type.'_includestr" value="'.$includestr{$type}.'" /><br />'.
+                              '<label>'.&mt('Text automatically added to e-mail:').' '.
+                              '<input type="text" name="'.$type.'_includestr" value="'.$includestr{$type}.'" /></label><br /><div style="margin: 4px 0 0 0;">'.
                               '<span class="LC_nobreak">'.&mt('Location:').' '.
                               '<label><input type="radio" name="'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'.
                               (' 'x2).
                               '<label><input type="radio" name="'.$type.'_includeloc" value="b"'.$locchecked{'b'}.' />'.&mt('in body').'</label>'.
-                              '</span></fieldset>';
+                              '</span></div></fieldset>';
+            } else {
+                $datatable .= '</div></fieldset>';
             }
             $datatable .= '</td></tr>'."\n";
             $rownum ++;
@@ -4642,9 +4895,9 @@
             $css_class = $rownum%2?' class="LC_odd_row"':'';
             $datatable .= '<tr'.$css_class.'>'.
                           '<td class="LC_left_item"><span class="LC_nobreak">'.
-                          $titles->{$item}.
+                          '<label for="'.$item.'">'.$titles->{$item}.'</label>'.
                           '</span></td><td class="LC_left_item">'.
-                          '<input type="text" name="'.$item.'" value="'.
+                          '<input type="text" name="'.$item.'" id="'.$item.'" value="'.
                           $current{$item}.'" size="5" /></td></tr>';
             $rownum ++;
         }
@@ -4652,46 +4905,44 @@
         $datatable .= '<tr'.$css_class.'>'.
                       '<td class="LC_left_item">'.
                       '<span class="LC_nobreak">'.$titles->{'errorweights'}.
-                      '</span></td><td class="LC_left_item"><table><tr>';
+                      '</span></td><td class="LC_left_item">'.
+                      '<div class="LC_grid" role="grid">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type ('E','W','N','U') {
-            $datatable .= '<td>'.$names->{$type}.'<br />'.
-                          '<input type="text" name="errorweights_'.$type.'" value="'.
-                          $weights{$type}.'" size="5" /></td>';
+            $datatable .= '<div class="LC_grid_cell" role="gridcell"><label for="errorweights_'.$type.'">'.$names->{$type}.'</label><br />'.
+                          '<input type="text" name="errorweights_'.$type.'" id="errorweights_'.$type.'" value="'.
+                          $weights{$type}.'" size="5" /></div>';
         }
-        $datatable .= '</tr></table></tr>';
+        $datatable .= '</div></div></td></tr>';
         $rownum ++;
         $css_class = $rownum%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td class="LC_left_item">'.
                       $titles->{'errorexcluded'}.'</td>'.
-                      '<td class="LC_left_item"><table>';
+                      '<td class="LC_left_item">'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.&mt('Exclude?').'</legend>'.
+                      '<div class="LC_grid" role="grid">';
         my $numinrow = 4;
         my @ids = sort(values(%Apache::lonnet::serverhomeIDs));
         for (my $i=0; $i<@ids; $i++) {
             my $rem = $i%($numinrow);
             if ($rem == 0) {
                 if ($i > 0) {
-                    $datatable .= '</tr>';
+                    $datatable .= '</div>';
                 }
-                $datatable .= '<tr>';
+                $datatable .= '<div class="LC_grid_row" role="row">';
             }
             my $check;
             if ($excluded{$ids[$i]}) {
                 $check = ' checked="checked" ';
             }
-            $datatable .= '<td class="LC_left_item">'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
                           '<span class="LC_nobreak"><label>'.
                           '<input type="checkbox" name="errorexcluded" '.
                           'value="'.$ids[$i].'"'.$check.' />'.
-                          $ids[$i].'</label></span></td>';
-        }
-        my $colsleft = $numinrow - @ids%($numinrow);
-        if ($colsleft > 1 ) {
-            $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'.
-                          ' </td>';
-        } elsif ($colsleft == 1) {
-            $datatable .= '<td class="LC_left_item"> </td>';
+                          $ids[$i].'</label></span></div>';
         }
-        $datatable .= '</tr></table></td></tr>';
+        $datatable .= '</div></div></fieldset></td></tr>';
         $rownum ++;
     } elsif ($position eq 'bottom') {
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
@@ -4745,9 +4996,9 @@
                 $css_class .= $customclass;
                 my $rowid = $optionsprefix.$status;
                 my $hidden = 1;
-                my $currstyle = 'display:none';
+                my $currstyle = 'display: none;';
                 if (grep(/^\Q$status\E$/, at overridden)) {
-                    $currstyle = 'display:table-row';
+                    $currstyle = 'display: table-row;';
                     $hidden = 0;
                 }
                 my $key = 'override_'.$status;
@@ -4805,8 +5056,9 @@
                        ' value="'.$item.'" />'.$title.'</label> ';
         }
     }
-    $output .= '</span><br />'.&mt('Others').':  '.
-               '<input type="text" name="override_'.$type.'_others" '.
+    $output .= '</span><br /><div style="margin: 4px 0 4px 0; padding: 0;">'.
+               '<label for="override_'.$type.'_others">'.&mt('Others').'</label>:  '.
+               '<input type="text" name="override_'.$type.'_others" id="override_'.$type.'_others" '.
                'value="'.$otheremails.'"  />';
     my %locchecked;
     foreach my $loc ('s','b') {
@@ -4815,17 +5067,18 @@
             last;
         }
     }
-    $output .= '<br />'.&mt('Bcc:').(' 'x6).
-               '<input type="text" name="override_'.$type.'_bcc" '.
-               'value="'.$bccemails.'"  /></fieldset>'.
+    $output .= '</div><div style="margin: 4px 0 4px 0; padding: 0;">'.
+               '<label for="override_'.$type.'_bcc">'.&mt('Bcc:').'</label>'.(' 'x6).
+               '<input type="text" name="override_'.$type.'_bcc" id="override_'.$type.'_bcc" '.
+               'value="'.$bccemails.'"  /></div></fieldset>'.
                '<fieldset><legend>'.&mt('Optional added text').'</legend>'.
-               &mt('Text automatically added to e-mail:').' '.
-               '<input type="text" name="override_'.$type.'_includestr" value="'.$includestr.'" /><br />'.
+               '<label>'.&mt('Text automatically added to e-mail:').' '.
+               '<input type="text" name="override_'.$type.'_includestr" value="'.$includestr.'" /></label><br /><div style="margin: 4px 0 0 0;">'.
                '<span class="LC_nobreak">'.&mt('Location:').' '.
                '<label><input type="radio" name="override_'.$type.'_includeloc" value="s"'.$locchecked{'s'}.' />'.&mt('in subject').'</label>'.
                (' 'x2).
                '<label><input type="radio" name="override_'.$type.'_includeloc" value="b"'.$locchecked{'b'}.' />'.&mt('in body').'</label>'.
-               '</span></fieldset>'.
+               '</span></div></fieldset>'.
                '</td></tr>'."\n";
     return $output;
 }
@@ -4981,8 +5234,10 @@
             my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
             $css_class = $itemcount%2?' class="LC_odd_row"':'';
             my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$num."_pos'".');"';
+            my $arialabel = &mt('Set display order for existing helpdesk role: [_1]',
+                                $desc);
             $datatable .= '<tr '.$css_class.'><td style="vertical-align: top"><b>'.$role.'</b><br />'.
-                          '<select name="helproles_'.$num.'_pos"'.$chgstr.'>';
+                          '<select name="helproles_'.$num.'_pos"'.$chgstr.' aria-label="'.$arialabel.'">';
             for (my $k=0; $k<=$maxnum; $k++) {
                 my $vpos = $k+1;
                 my $selstr;
@@ -4995,17 +5250,17 @@
                           '<input type="hidden" name="helproles_'.$num.'" value="'.$role.'" />'.
                           '</td>'.
                           '<td><fieldset><legend>'.&mt('Role name').'</legend>'.
-                          &mt('Name shown to users:').
+                          '<label>'.&mt('Name shown to users:').
                           '<input type="text" name="helproles_'.$num.'_desc" value="'.$desc.'" />'.
-                          '</fieldset>'.
-                          &helpdeskroles_access($dom,$prefix,$num,$add_class,$current{$role},\@accesstypes,
+                          '</label></fieldset>'.
+                          &helpdeskroles_access($dom,$desc,$prefix,$num,$add_class,$current{$role},\@accesstypes,
                                                 $othertitle,$usertypes,$types,\%domhelpdesk).
                           '<fieldset>'.
                           '<legend>'.&mt('Role privileges').&adhocbutton($prefix,$num,'privs','show').'</legend>'.
                           &Apache::lonuserutils::custom_role_table($crstype,\%full,\%levels,
                                                                    \%levelscurrent,$identifier,
                                                                    'LC_hidden',$prefix.$num.'_privs').
-                          '</fieldset></td>';
+                          '</fieldset></td></tr>';
             $itemcount ++;
         }
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
@@ -5020,9 +5275,10 @@
         &Apache::lonuserutils::custom_role_privs(\%privs,\%full,\%levels,\%levelscurrent);
         my @templateroles = &Apache::lonuserutils::custom_template_roles($context,$crstype);
         my $chgstr = ' onchange="javascript:reorderHelpRoles(this.form,'."'helproles_".$count."_pos'".');"';
-        $datatable .= '<tr '.$css_class.'><td style="vertical-align: top"><span class="LC_nobreak"><label>'.
+        my $arialabel = &mt('Set display order for new helpdesk role');
+        $datatable .= '<tr '.$css_class.'><td style="vertical-align: top"><span class="LC_nobreak">'.
                       '<input type="hidden" name="helproles_maxnum" value="'.$maxnum.'" />'."\n".
-                      '<select name="helproles_'.$count.'_pos"'.$chgstr.'>';
+                      '<select name="helproles_'.$count.'_pos"'.$chgstr.' aria-label="'.$arialabel.'">';
         for (my $k=0; $k<$maxnum+1; $k++) {
             my $vpos = $k+1;
             my $selstr;
@@ -5031,19 +5287,20 @@
             }
             $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
         }
+        my $labeltext = &mt('Add a new helpdesk role');
         $datatable .= '</select> '."\n".
-                      '<input type="checkbox" name="newcusthelp" value="'.$count.'" />'. &mt('Add').
-                      '</label></span></td>'.
+                      '<input type="checkbox" name="newcusthelp" value="'.$count.'" aria-label="'.$labeltext.'" />'.
+		      &mt('Add').'</span></td>'.
                       '<td><fieldset><legend>'.&mt('Role name').'</legend>'.
                       '<span class="LC_nobreak">'.
-                      &mt('Internal name:').
+                      '<label>'.&mt('Internal name:').
                       '<input type="text" size="10" name="custhelpname'.$count.'" value="" />'.
-                      '</span>'.(' 'x4).
+                      '</label></span>'.(' 'x4).
                       '<span class="LC_nobreak">'.
-                      &mt('Name shown to users:').
+                      '<label>'.&mt('Name shown to users:').
                       '<input type="text" size="20" name="helproles_'.$count.'_desc" value="" />'.
-                      '</span></fieldset>'.
-                       &helpdeskroles_access($dom,$prefix,$count,'',undef,\@accesstypes,$othertitle,
+                      '</label></span></fieldset>'.
+                       &helpdeskroles_access($dom,'',$prefix,$count,'',undef,\@accesstypes,$othertitle,
                                              $usertypes,$types,\%domhelpdesk).
                       '<fieldset><legend>'.&mt('Role privileges').'</legend>'.
                       &Apache::lonuserutils::custom_role_header($context,$crstype,
@@ -5203,7 +5460,7 @@
 }
 
 sub helpdeskroles_access {
-    my ($dom,$prefix,$num,$add_class,$current,$accesstypes,$othertitle,
+    my ($dom,$name,$prefix,$num,$add_class,$current,$accesstypes,$othertitle,
         $usertypes,$types,$domhelpdesk) = @_;
     return unless ((ref($accesstypes) eq 'ARRAY') && (ref($domhelpdesk) eq 'HASH'));
     my %lt = &Apache::lonlocal::texthash(
@@ -5241,27 +5498,27 @@
             }
         }
     }
-    $output = '<fieldset id="'.$prefix.$num.'_usage"><legend>'.$lt{'rou'}.'</legend>'.
+    $output = '<fieldset id="'.$prefix.$num.'_usage">'.
+              '<legend>'.$lt{'rou'}.'</legend>'.
               '<p>'.$lt{'whi'}.'</p>';
     foreach my $access (@{$accesstypes}) {
-        $output .= '<p><label><input type="radio" name="'.$prefix.$num.'_access" value="'.$access.'" '.$usecheck{$access}.
+	$output .= '<p><label><input type="radio" name="'.$prefix.$num.'_access" value="'.$access.'" '.$usecheck{$access}.
                    ' onclick="helpdeskAccess('."'$num'".');" />'.
-                   $lt{$access}.'</label>';
+                   $lt{$access}.'</label></p>';
         if ($access eq 'status') {
             $output .= '<div id="'.$prefix.$num.'_bystatus" style="display:'.$displaydiv{$access}.'">'.
-                       &Apache::lonuserutils::adhoc_status_types($dom,$prefix,$num,$current->{$access},
+                       &Apache::lonuserutils::adhoc_status_types($dom,$name,$prefix,$num,$current->{$access},
                                                                  $othertitle,$usertypes,$types).
                        '</div>';
         } elsif (($access eq 'inc') && (keys(%{$domhelpdesk}) > 0)) {
             $output .= '<div id="'.$prefix.$num.'_notinc" style="display:'.$displaydiv{$access}.'">'.
-                       &Apache::lonuserutils::adhoc_staff($access,$prefix,$num,$current->{$access},$domhelpdesk).
+                       &Apache::lonuserutils::adhoc_staff($access,$name,$prefix,$num,$current->{$access},$domhelpdesk).
                        '</div>';
         } elsif (($access eq 'exc') && (keys(%{$domhelpdesk}) > 0)) {
             $output .= '<div id="'.$prefix.$num.'_notexc" style="display:'.$displaydiv{$access}.'">'.
-                       &Apache::lonuserutils::adhoc_staff($access,$prefix,$num,$current->{$access},$domhelpdesk).
+                       &Apache::lonuserutils::adhoc_staff($access,$name,$prefix,$num,$current->{$access},$domhelpdesk).
                        '</div>';
         }
-        $output .= '</p>';
     }
     $output .= '</fieldset>';
     return $output;
@@ -5269,7 +5526,7 @@
 
 sub radiobutton_prefs {
     my ($settings,$toggles,$defaultchecked,$choices,$itemcount,$onclick,
-        $additional,$align,$firstval) = @_;
+        $additional,$align,$firstval,$lineheight) = @_;
     return unless ((ref($toggles) eq 'ARRAY') && (ref($defaultchecked) eq 'HASH') &&
                    (ref($choices) eq 'HASH'));
 
@@ -5298,10 +5555,13 @@
     if ($onclick) {
         $onclick = ' onclick="'.$onclick.'"';
     }
+    if ($lineheight =~ /^\d+$/) {
+        $lineheight = ' style="line-height: '.$lineheight.'%;"'; 
+    }
     foreach my $item (@{$toggles}) {
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .=
-            '<tr'.$css_class.'><td style="vertical-align: top">'.
+            '<tr'.$css_class.'><td style="vertical-align: top; line-height: 170%;">'.
             '<span class="LC_nobreak">'.$choices->{$item}.
             '</span></td>';
         if ($align eq 'left') {
@@ -5309,7 +5569,9 @@
         } else {
             $datatable .= '<td class="LC_right_item">';
         }
-        $datatable .= '<span class="LC_nobreak">';
+        $datatable .= '<fieldset class="LC_borderless"'.$lineheight.'>'.
+                      '<legend class="LC_visually_hidden">'.$choices->{$item}.'</legend>'.
+                      '<span class="LC_nobreak">';
         if ($firstval eq 'no') {
             $datatable .=
                 '<label><input type="radio" name="'.
@@ -5323,7 +5585,7 @@
                 '</label> <label><input type="radio" name="'.$item.'" '.
                 $checkedoff{$item}.' value="0"'.$onclick.' />'.&mt('No').'</label>';
         }
-        $datatable .= '</span>'.$additional.'</td></tr>';
+        $datatable .= '</span></fieldset>'.$additional.'</td></tr>';
         $itemcount ++;
     }
     return ($datatable,$itemcount);
@@ -5404,9 +5666,9 @@
             }
             if ($showextra) {
                 $numshown ++;
-                $divsty = 'display:inline-block';
+                $divsty = 'display: inline-block;';
             } else {
-                $divsty = 'display:none';
+                $divsty = 'display: none;';
             }
             $extra .= '<fieldset id="'.$context.'_info_'.$hostid.'" style="'.$divsty.'">'.
                       '<legend>'.$hostid.'</legend>';
@@ -5415,14 +5677,14 @@
                                    &HTML::Entities::encode($env{'request.role'},'\'<>"&').
                                    '&destinationurl=/adm/domainprefs">'.&mt('Switch Server').'</a>';
                 if (exists($privkeys->{$hostid})) {
-                    $extra .= '<div id="'.$context.'_divcurrprivkey_'.$hostid.'" style="display:inline-block" />'.
+                    $extra .= '<div id="'.$context.'_divcurrprivkey_'.$hostid.'" style="display: inline-block;">'.
                               '<span class="LC_nobreak">'.
-                              &mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'.
+                              &mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).'</span>'.
                               '<span class="LC_nobreak">'.&mt('Change?').
                               '<label><input type="radio" value="0" name="'.$context.'_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$context','$hostid'".');" checked="checked" />'.&mt('No').'</label>'.
                               (' 'x2).
                               '<label><input type="radio" value="1" name="'.$context.'_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$context','$hostid'".');" />'.&mt('Yes').
-                              '</label>  </span><div id="'.$context.'_divchgprivkey_'.$hostid.'" style="display:none" />'.
+                              '</label>  </span></div><div id="'.$context.'_divchgprivkey_'.$hostid.'" style="display: none;">'.
                               '<span class="LC_nobreak"> - '.&mt('submit from server ([_1]): [_2].',$hostid,$switchserver).
                               '</span></div>';
                 } else {
@@ -5431,21 +5693,21 @@
                               '</span>'."\n";
                 }
             } elsif (exists($privkeys->{$hostid})) {
-                $extra .= '<div id="'.$context.'_divcurrprivkey_'.$hostid.'" style="display:inline-block" /><span class="LC_nobreak">'.
+                $extra .= '<div id="'.$context.'_divcurrprivkey_'.$hostid.'" style="display: inline-block;"><span class="LC_nobreak">'.
                           &mt('Encryption Key').': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'.
                           '<span class="LC_nobreak">'.&mt('Change?').
                           '<label><input type="radio" value="0" name="'.$context.'_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$context','$hostid'".');" checked="checked" />'.&mt('No').'</label>'.
                           (' 'x2).
                           '<label><input type="radio" value="1" name="'.$context.'_changeprivkey_'.$hostid.'" onclick="javascript:togglePrivKey(this.form,'."'$context','$hostid'".');" />'.&mt('Yes').
-                          '</label>  </span><div id="'.$context.'_divchgprivkey_'.$hostid.'" style="display:none" />'.
-                          '<span class="LC_nobreak">'.&mt('New Key').':'.
-                          '<input type="password" size="20" name="'.$context.'_privkey_'.$hostid.'" value="" autocomplete="new-password" />'.
-                          '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.'.$context.'_privkey_'.$hostid.'.type='."'text'".' } else { this.form.'.$context.'_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'.
+                          '</label>  </span><div id="'.$context.'_divchgprivkey_'.$hostid.'" style="display: none;">'.
+                          '<span class="LC_nobreak"><label>'.&mt('New Key').':'.
+                          '<input type="password" size="20" name="'.$context.'_privkey_'.$hostid.'" value="" autocomplete="new-password" /></label>'.
+                          ' <label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.'.$context.'_privkey_'.$hostid.'.type='."'text'".' } else { this.form.'.$context.'_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>'.
                           '</span></div>';
             } else {
-                $extra .= '<span class="LC_nobreak">'.&mt('Encryption Key').':'.
-                          '<input type="password" size="20" name="'.$context.'_privkey_'.$hostid.'" value="" autocomplete="new-password" />'.
-                          '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.'.$context.'_privkey_'.$hostid.'.type='."'text'".' } else { this.form.'.$context.'_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label>';
+                $extra .= '<span class="LC_nobreak"><label>'.&mt('Encryption Key').':'.
+                          '<input type="password" size="20" name="'.$context.'_privkey_'.$hostid.'" value="" autocomplete="new-password" /></label>'.
+                          ' <label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.'.$context.'_privkey_'.$hostid.'.type='."'text'".' } else { this.form.'.$context.'_privkey_'.$hostid.'.type='."'password'".' }" />'.&mt('Visible input').'</label></span>';
             }
             $extra .= '</fieldset>';
         }
@@ -5480,12 +5742,12 @@
                                               \%choices,$itemcount,$onclick,'','left','no');
 
     $css_class = $itemcount%2?' class="LC_odd_row"':'';
-    my $noprivkeysty = 'display:inline-block';
+    my $noprivkeysty = 'display: inline-block;';
     if ($numshown) {
-        $noprivkeysty = 'display:none';
+        $noprivkeysty = 'display: none;';
     }
-    $output .= '<tr '.$css_class.'><td><span class="LC_nobreak">'.&mt('Encryption Key(s)').'</td>'.
-               '<td><div id="'.$context.'_noprivkey" style="'.$noprivkeysty.'" >'.
+    $output .= '<tr '.$css_class.'><td><span class="LC_nobreak">'.&mt('Encryption Key(s)').'</span></td>'.
+               '<td><div id="'.$context.'_noprivkey" style="'.$noprivkeysty.'">'.
                '<span class="LC_nobreak">'.&mt('Not in use').'</span></div>'.
                $extra.
                '</td></tr>';
@@ -5637,8 +5899,9 @@
                 $checkedavailable{'no'} = '';
             }
             my $chgstr = ' onchange="javascript:reorderProctoring(this.form,'."'proctoring_pos_".$provider."'".');"';
+            my $arialabel = &mt('Set list order for [_1]',$providernames{$provider});
             $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'
-                         .'<select name="proctoring_pos_'.$provider.'"'.$chgstr.'>';
+                         .'<select name="proctoring_pos_'.$provider.'"'.$chgstr.' aria-label="'.$arialabel.'">';
             for (my $k=0; $k<$maxnum; $k++) {
                 my $vpos = $k+1;
                 my $selstr;
@@ -5659,27 +5922,30 @@
             }
             $datatable .=
                 '</select>'.(' 'x2).'<b>'.$providernames{$provider}.'</b></span><br />'.
-                '<span class="LC_nobreak">'.$lt{'avai'}.' '.
+                '<fieldset class="LC_borderless">'.
+                '<legend class="LC_visually_hidden">'.$lt{'avai'}.'</legend>'.
+                '<span class="LC_nobreak"><span aria-hidden="true">'.$lt{'avai'}.' </span>'.
                 '<label><input type="radio" name="proctoring_available_'.$provider.'" value="1"'.$onclickavailable.$checkedavailable{yes}.' />'.&mt('Yes').'</label> '."\n".
-                '<label><input type="radio" name="proctoring_available_'.$provider.'" value="0"'.$onclickavailable.$checkedavailable{no}.' />'.&mt('No').'</label></span>'."\n".
+                '<label><input type="radio" name="proctoring_available_'.$provider.'" value="0"'.$onclickavailable.$checkedavailable{no}.' />'.&mt('No').'</label></span></fieldset>'."\n".
                 '</td>'.
                 '<td colspan="2">'.
-                '<fieldset class="proctoring_'.$provider.'" style="display:'.$optionsty.'"><legend>'.$lt{'base'}.'</legend>'.
-                '<span class="LC_nobreak">'.$lt{'version'}.':<select name="proctoring_'.$provider.'_version">'.
+                '<fieldset class="proctoring_'.$provider.'" style="display:'.$optionsty.'; line-height: 180%;">'.
+                '<legend>'.$lt{'base'}.'</legend>'.
+                '<span class="LC_nobreak"><label for="proctoring_'.$provider.'_version">'.$lt{'version'}.'</label>:<select name="proctoring_'.$provider.'_version" id="proctoring_'.$provider.'_version">'.
                 '<option value="'.$version.'" selected="selected">'.$version.'</option></select></span> '."\n".
                 (' 'x2).
-                '<span class="LC_nobreak">'.$lt{'sigmethod'}.':<select name="proctoring_'.$provider.'_sigmethod">'.
+                '<span class="LC_nobreak"><label>'.$lt{'sigmethod'}.':<select name="proctoring_'.$provider.'_sigmethod">'.
                 '<option value="HMAC-SHA1" selected="selected">HMAC-SHA1</option>'.
-                '<option value="HMAC-SHA256">HMAC-SHA256</option></select></span>'.
+                '<option value="HMAC-SHA256">HMAC-SHA256</option></select></label></span>'.
                 (' 'x2).
-                '<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" size="5" name="proctoring_'.$provider.'_lifetime" value="'.$lifetime.'" /></span> '."\n".
+                '<span class="LC_nobreak"><label>'.$lt{'lifetime'}.':<input type="text" size="5" name="proctoring_'.$provider.'_lifetime" value="'.$lifetime.'" /></label></span> '."\n".
                 '<br />'.
-                '<span class="LC_nobreak">'.$lt{'url'}.':<input type="text" size="40" name="proctoring_'.$provider.'_url" value="'.$current{'url'}.'" /></span> '."\n".
+                '<span class="LC_nobreak"><label>'.$lt{'url'}.':<input type="text" size="40" name="proctoring_'.$provider.'_url" value="'.$current{'url'}.'" /></label></span> '."\n".
                 '<br />'.
-                '<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="proctoring_'.$provider.'_key" value="'.$current{'key'}.'" /></span> '."\n".
+                '<span class="LC_nobreak"><label>'.$lt{'key'}.':<input type="text" size="25" name="proctoring_'.$provider.'_key" value="'.$current{'key'}.'" /></label></span> '."\n".
                 (' 'x2).
-                '<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="proctoring_'.$provider.'_secret" value="'.$current{'secret'}.'" />'.
-                '<label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.proctoring_'.$provider.'_secret.type='."'text'".' } else { this.form.proctoring_'.$provider.'_secret.type='."'password'".' }" />'.$lt{'visible'}.'</label></span><br />'."\n";
+                '<span class="LC_nobreak"><label>'.$lt{'secret'}.':<input type="password" size="20" name="proctoring_'.$provider.'_secret" value="'.$current{'secret'}.'" /></label>'.
+                ' <label><input type="checkbox" name="visible" onclick="if (this.checked) { this.form.proctoring_'.$provider.'_secret.type='."'text'".' } else { this.form.proctoring_'.$provider.'_secret.type='."'password'".' }" />'.$lt{'visible'}.'</label></span><br />'."\n";
             $datatable .= '<span class="LC_nobreak">'.$lt{'icon'}.': ';
             if ($imgsrc) {
                 $datatable .= $imgsrc.
@@ -5691,8 +5957,10 @@
             if ($switchserver) {
                 $datatable .= &mt('Upload to library server: [_1]',$switchserver);
             } else {
-                $datatable .= '<input type="file" name="proctoring_image_'.$provider.'" value="" />';
+                my $labeltext = &mt('Choose icon file to upload');
+                $datatable .= '<input type="file" name="proctoring_image_'.$provider.'" value="" aria-label="'.$labeltext.'" />';
             }
+            $datatable .= '</span>';
             unless ($imgsrc) {
                 $datatable .= '<br />('.&mt('if larger than 21x21 pixels, image will be scaled').')';
             }
@@ -5712,7 +5980,7 @@
                                 $unseluserdom = '';
                             }
                             $datatable .= ': '.
-                                '<select name="proctoring_userincdom_'.$provider.'">'.
+                                '<select name="proctoring_userincdom_'.$provider.'" aria-label="'.&mt('Format for user ID in LTI payload').'">'.
                                 '<option value="0"'.$unseluserdom.'>'.$lt{'username'}.'</option>'.
                                 '<option value="1"'.$seluserdom.'>'.$lt{'uname:dom'}.'</option>'.
                                 '</select> ';
@@ -5750,7 +6018,7 @@
                     $datatable .= '<fieldset class="proctoring_'.$provider.'" style="display:'.$optionsty.'"><legend>'.$lt{'defa'}.'</legend>';
                     my ($rem,$numinrow,$dropdowns);
                     if ($provider eq 'proctorio') { 
-                        $datatable .= '<table>';
+                        $datatable .= '<div class="LC_grid" role="grid" style="margin: 0;">';
                         $numinrow = 4;
                     }
                     my $i = 0;
@@ -5778,13 +6046,17 @@
                                                   (' 'x2);
                                 }
                                 $datatable .= '</span><br />'.
-                                              '<div class="LC_left_float">'.$fieldtitles{'linktext'}.'<br />'.
+                                              '<div class="LC_left_float"><label for="proctoring_linktext_'.$provider.'">'.
+                                              $fieldtitles{'linktext'}.'</label><br />'.
                                               '<input type="text" name="proctoring_linktext_'.$provider.'" '.
+                                              'id="proctoring_linktext_'.$provider.'" '.
                                               'size="25" value="'.$currentdef{'linktext'}.'" /></div>'.
-                                              '<div class="LC_left_float">'.$fieldtitles{'explanation'}.'<br />'.
-                                              '<textarea name="proctoring_explanation_'.$provider.'" rows="5" cols="40">'.
+                                              '<div class="LC_left_float"><label for="proctoring_explanation_'.$provider.'">'.
+                                              $fieldtitles{'explanation'}.'</label><br />'.
+                                              '<textarea name="proctoring_explanation_'.$provider.'" '.
+                                              'id="proctoring_explanation_'.$provider.'" rows="5" cols="40">'.
                                               $currentdef{'explanation'}.
-                                              '</textarea></div><div style=""></div><br />';
+                                              '</textarea></div><div style="padding:0;clear:both;margin:0;border:0"></div><br />';
                             }
                         } else {
                             if ((exists($options{$field})) && (ref($options{$field}) eq 'ARRAY')) {
@@ -5792,7 +6064,7 @@
                                 unless ($checked) {
                                     $selnone = ' selected="selected"';
                                 }
-                                $output .= '<span class="LC_nobreak">'.$fieldtitles{$field}.': '.
+                                $output .= '<span class="LC_nobreak"><label>'.$fieldtitles{$field}.': '.
                                            '<select name="proctoring_defaults_'.$field.'_'.$provider.'">'.
                                            '<option value=""'.$selnone.'>'.&mt('Not in use').'</option>'; 
                                 foreach my $option (@{$options{$field}}) {
@@ -5802,61 +6074,41 @@
                                     }
                                     $output .= '<option value="'.$option.'"'.$sel.'>'.$fieldtitles{$option}.'</option>';
                                 }
-                                $output .= '</select></span>';
+                                $output .= '</select></label></span>';
                                 push(@selectboxes,$output);
                             } else {
                                 $rem = $i%($numinrow);
                                 if ($rem == 0) {
                                     if ($i > 0) {
-                                        $datatable .= '</tr>';
+                                        $datatable .= '</div>';
                                     }
-                                    $datatable .= '<tr>';
+                                    $datatable .= '<div class="LC_grid_row" role="row">';
                                 }
-                                $datatable .= '<td class="LC_left_item">'.
+                                $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
                                               '<span class="LC_nobreak">'.
                                               '<label><input type="checkbox" name="proctoring_defaults_'.$provider.'" value="'.$field.'"'.$checked.' />'.
-                                              $fieldtitles{$field}.'</label></span></td>';
+                                              $fieldtitles{$field}.'</label></span></div>';
                                 $i++;
                             }
                         }
                     }
                     if ($provider eq 'proctorio') {
-                        if ($numinrow) {
-                            $rem = $i%$numinrow;
-                        }
-                        my $colsleft = $numinrow - $rem;
-                        if ($colsleft > 1) {
-                            $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
-                        } else {
-                            $datatable .= '<td class="LC_left_item">';
-                        }
-                        $datatable .= ' '.
-                                      '</td></tr></table>';
+                        $datatable .= '</div></div>';
                         if (@selectboxes) {
-                            $datatable .= '<hr /><table>';
+                            $datatable .= '<hr /><div class="LC_grid" role="grid">';
                             $numinrow = 2;
                             for (my $i=0; $i<@selectboxes; $i++) {
                                 $rem = $i%($numinrow);
                                 if ($rem == 0) {
                                     if ($i > 0) {
-                                        $datatable .= '</tr>';
+                                        $datatable .= '</div>';
                                     }
-                                    $datatable .= '<tr>';
+                                    $datatable .= '<div class="LC_grid_row" role="row">';
                                 }
-                                $datatable .= '<td class="LC_left_item">'.
-                                              $selectboxes[$i].'</td>';
-                            }
-                            if ($numinrow) {
-                                $rem = $i%$numinrow;
+                                $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
+                                              $selectboxes[$i].'</div>';
                             }
-                            $colsleft = $numinrow - $rem;
-                            if ($colsleft > 1) {
-                                $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
-                            } else {
-                                $datatable .= '<td class="LC_left_item">';
-                            }
-                            $datatable .= ' '.
-                                          '</td></tr></table>';
+                            $datatable .= '</div></div>';
                         }
                     }
                     $datatable .= '</fieldset>';
@@ -5866,7 +6118,7 @@
                                   '<legend>'.&mt('Configurable in course').'</legend>';
                     my ($rem,$numinrow);
                     if ($provider eq 'proctorio') {
-                        $datatable .= '<table>';
+                        $datatable .= '<div class="LC_grid" role="grid" style="margin: 0;">';
                         $numinrow = 4;
                     }
                     my $i = 0;
@@ -5879,11 +6131,11 @@
                             $rem = $i%($numinrow);
                             if ($rem == 0) {
                                 if ($i > 0) {
-                                    $datatable .= '</tr>';
+                                    $datatable .= '</div>';
                                 }
-                                $datatable .= '<tr>';
+                                $datatable .= '<div class="LC_grid_row" role="row">';
                             }
-                            $datatable .= '<td class="LC_left_item>';
+                            $datatable .= '<div class="LC_grid_cell" role="gridcell">';
                         }
                         my $checked;
                         if ($crsconfig{$item}) {
@@ -5894,36 +6146,31 @@
                                       $name.'</label></span>';
                         if ($provider eq 'examity') {
                             $datatable .= '  ';
+                        } else {
+                            $datatable .= '</div>';
                         }
                         $datatable .= "\n";
                         $i++;
                     }
                     if ($provider eq 'proctorio') {
-                        if ($numinrow) {
-                            $rem = $i%$numinrow;
-                        }
-                        my $colsleft = $numinrow - $rem;
-                        if ($colsleft > 1) {
-                            $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
-                        } else {
-                            $datatable .= '<td class="LC_left_item">';
-                        }
-                        $datatable .= ' '.
-                                      '</td></tr></table>';
+                        $datatable .= '</div></div>';
                     }
                     $datatable .= '</fieldset>';
                 }
                 if ($showroles) {
                     $datatable .= '<fieldset class="proctoring_'.$provider.'" style="display:'.$optionsty.'">'.
-                                  '<legend>'.&mt('Role mapping').'</legend><table><tr>';
+                                  '<legend>'.&mt('Role mapping').'</legend>'.
+                                  '<div class="LC_grid" role="grid" style="margin: 0">'.
+                                  '<div class="LC_grid_row" role="row">';
                     foreach my $role (@courseroles) {
                         my ($selected,$selectnone);
                         if (!$rolemaps{$role}) {
                             $selectnone = ' selected="selected"';
                         }
-                        $datatable .= '<td style="text-align: center">'.
-                                      &Apache::lonnet::plaintext($role,'Course').'<br />'.
-                                      '<select name="proctoring_roles_'.$role.'_'.$provider.'">'.
+                        $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                                      '<label for="proctoring_roles_'.$role.'_'.$provider.'">'.
+                                      &Apache::lonnet::plaintext($role,'Course').'</label><br />'.
+                                      '<select name="proctoring_roles_'.$role.'_'.$provider.'" id="proctoring_roles_'.$role.'_'.$provider.'">'.
                                       '<option value=""'.$selectnone.'>'.&mt('Select').'</option>';
                         foreach my $ltirole (@ltiroles) {
                             unless ($selectnone) {
@@ -5935,34 +6182,41 @@
                             }
                             $datatable .= '<option value="'.$ltirole.'"'.$selected.'>'.$ltirole.'</option>';
                         }
-                        $datatable .= '</select></td>';
+                        $datatable .= '</select></div>';
                     }
-                    $datatable .= '</tr></table></fieldset>'.
+                    $datatable .= '</div></div></fieldset>'.
                                   '<fieldset class="proctoring_'.$provider.'" style="display:'.$optionsty.'">'.
                                   '<legend>'.&mt('Custom items sent on launch').'</legend>'.
                                   '<table><tr><th>'.&mt('Action').'</th><th>'.&mt('Name').'</th><th>'.&mt('Value').'</th></tr>'.
-                                  '<tr><td></td><td>lms</td>'.
+                                  '<tr><td></td><td><label for="proctoring_customval_lms_'.$provider.'">lms</label></td>'.
                                   '<td><input type="text" name="proctoring_customval_lms_'.$provider.'"'.
-                                  ' value="Loncapa" disabled="disabled"/></td></tr>';
+                                  ' id="proctoring_customval_lms_'.$provider.'" value="Loncapa" disabled="disabled" />'.
+                                  '</td></tr>';
                     if ((ref($settings) eq 'HASH') && (ref($settings->{$provider}) eq 'HASH') &&
                         (ref($settings->{$provider}->{'custom'}) eq 'HASH')) {
                         my %custom = %{$settings->{$provider}->{'custom'}};
                         if (keys(%custom) > 0) {
                             foreach my $key (sort(keys(%custom))) {
                                 next if ($key eq 'lms');
+                                my $labeltext = &mt('Value of custom item [_1] in launch payload for [_2]',
+                                                    $key,$providernames{$provider});  
                                 $datatable .= '<tr><td><span class="LC_nobreak">'.
                                               '<label><input type="checkbox" name="proctoring_customdel_'.$provider.'" value="'.
                                               $key.'" />'.&mt('Delete').'</label></span></td><td>'.$key.'</td>'.
                                               '<td><input type="text" name="proctoring_customval_'.$key.'_'.$provider.'"'.
-                                              ' value="'.$custom{$key}.'" /></td></tr>';
+                                              ' value="'.$custom{$key}.'" aria-label="'.$labeltext.'" /></td></tr>';
                             }
                         }
                     }
+                    my $newkey = &mt('Set name of custom key=value pair to include in LTI payload for [_1]',
+                                     $providernames{$provider});
+                    my $newvalue = &mt('Set value of custom key=value pair to include in LTI payload for [_1]',
+                                       $providernames{$provider});
                     $datatable .= '<tr><td><span class="LC_nobreak">'.
                                   '<label><input type="checkbox" name="proctoring_customadd" value="'.$provider.'" />'.
-                                  &mt('Add more').'</label></span></td><td><input type="text" name="proctoring_custom_name_'.$provider.'" />'.
-                                  '</td><td><input type="text" name="proctoring_custom_value_'.$provider.'" /></td></tr>'.
-                                  '</table></fieldset></td></tr>'."\n";
+                                  &mt('Add more').'</label></span></td><td><input type="text" name="proctoring_custom_name_'.$provider.'" aria-label="'.$newkey.'" />'.
+                                  '</td><td><input type="text" name="proctoring_custom_value_'.$provider.'" aria-label="'.$newvalue.'" /></td></tr>'.
+                                  '</table></fieldset>'."\n";
                 }
                 $datatable .= '</td></tr>';
             }
@@ -6247,8 +6501,9 @@
                     $checkedcrsinc{'yes'} = '';
                 }
                 my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_".$item."'".');"';
+                my $poslabel = &mt('Set list order for [_1]',$consumer);
                 $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'
-                             .'<select name="lti_pos_'.$item.'"'.$chgstr.'>';
+                             .'<select name="lti_pos_'.$item.'"'.$chgstr.' aria-label="'.$poslabel.'">';
                 for (my $k=0; $k<=$maxnum; $k++) {
                     my $vpos = $k+1;
                     my $selstr;
@@ -6262,36 +6517,38 @@
                     &mt('Delete?').'</label></span></td>'.
                     '<td colspan="2">'.
                     '<fieldset><legend>'.&mt('Required settings').'</legend>'.
-                    '<span class="LC_nobreak">'.$lt{'consumer'}.
-                    ':<input type="text" size="15" name="lti_consumer_'.$i.'" value="'.$consumer.'" /></span> '.
+                    '<span class="LC_nobreak"><label>'.$lt{'consumer'}.
+                    ':<input type="text" size="15" name="lti_consumer_'.$i.'" value="'.$consumer.'" /></label></span> '.
                     (' 'x2).
-                    '<span class="LC_nobreak">'.$lt{'version'}.':<select name="lti_version_'.$i.'">'.
+                    '<span class="LC_nobreak"><label for="lti_version_'.$i.'">'.
+                    $lt{'version'}.'</label>:<select name="lti_version_'.$i.'" id="lti_version_'.$i.'">'.
                     '<option value="LTI-1p0" selected="selected">1.1</option></select></span> '.
                     (' 'x2).
-                    '<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" name="lti_lifetime_'.$i.'"'.
-                    'value="'.$lifetime.'" size="3" /></span><br /><br />';
+                    '<span class="LC_nobreak"><label>'.$lt{'lifetime'}.':<input type="text" name="lti_lifetime_'.$i.'" '.
+                    'value="'.$lifetime.'" size="3" /></label></span><br /><br />';
                 if ($key ne '') {
-                    $datatable .= '<span class="LC_nobreak">'.$lt{'key'};
+                    $datatable .= '<span class="LC_nobreak">';
                     if ($switchserver) {
-                        $datatable .= ': ['.&mt('[_1] to view/edit',$switchserver).']';
+                        $datatable .= $lt{'key'}.': ['.&mt('[_1] to view/edit',$switchserver).']';
                     } else {
-                        $datatable .= ':<input type="text" size="25" name="lti_key_'.$i.'" value="'.$key.'" autocomplete="off" />';
+                        $datatable .= '<label>'.$lt{'key'}.
+                                      ':<input type="text" size="25" name="lti_key_'.$i.'" value="'.$key.'" autocomplete="off" />';
                     }
                     $datatable .= '</span> '.(' 'x2);
                 } elsif (!$switchserver) {
-                    $datatable .= '<span class="LC_nobreak">'.$lt{'key'}.':'.
-                                  '<input type="text" size="25" name="lti_key_'.$i.'" value="'.$key.'" autocomplete="off" />'.
+                    $datatable .= '<span class="LC_nobreak"><label>'.$lt{'key'}.':'.
+                                  '<input type="text" size="25" name="lti_key_'.$i.'" value="'.$key.'" autocomplete="off" /></label>'.
                                   '</span> '.(' 'x2);
                 }
                 if ($switchserver) {
                     if ($usable ne '') {
-                        $datatable .= '<div id="lti_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'.
+                        $datatable .= '<div id="lti_divcurrsecret_'.$i.'" style="display: inline-block;"><span class="LC_nobreak">'.
                                       $lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'.
                                       '<span class="LC_nobreak">'.&mt('Change secret?').
                                       '<label><input type="radio" value="0" name="lti_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','lti'".');" checked="checked" />'.&mt('No').'</label>'.
                                       (' 'x2).
                                      '<label><input type="radio" value="1" name="lti_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','lti'".');" />'.&mt('Yes').'</label>'.(' 'x2).
-                                      '</span><div id="lti_divchgsecret_'.$i.'" style="display:none" />'.
+                                      '</span><div id="lti_divchgsecret_'.$i.'" style="display: none;">'.
                                       '<span class="LC_nobreak"> - '.$switchmessage.'</span>'.
                                       '</div>';
                     } elsif ($key eq '') {
@@ -6301,21 +6558,21 @@
                     }
                 } else {
                     if ($usable ne '') {
-                        $datatable .= '<div id="lti_divcurrsecret_'.$i.'" style="display:inline-block" /><span class="LC_nobreak">'.
+                        $datatable .= '<div id="lti_divcurrsecret_'.$i.'" style="display: inline-block;"><span class="LC_nobreak">'.
                                       $lt{'secret'}.': ['.&mt('not shown').'] '.(' 'x2).'</span></div>'.
                                       '<span class="LC_nobreak">'.&mt('Change?').
                                       '<label><input type="radio" value="0" name="lti_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','lti'".');" checked="checked" />'.&mt('No').'</label>'.
                                       (' 'x2).
                                       '<label><input type="radio" value="1" name="lti_changesecret_'.$i.'" onclick="javascript:toggleChgSecret(this.form,'."'$i','secret','lti'".');" />'.&mt('Yes').
-                                      '</label>  </span><div id="lti_divchgsecret_'.$i.'" style="display:none" />'.
-                                      '<span class="LC_nobreak">'.&mt('New Secret').':'.
-                                      '<input type="password" size="20" name="lti_secret_'.$i.'" value="" autocomplete="new-password" />'.
-                                      '<label><input type="checkbox" name="lti_visible_'.$i.'" id="lti_visible_'.$i.'" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label></span></div>';
+                                      '</label>  </span><div id="lti_divchgsecret_'.$i.'" style="display: none;">'.
+                                      '<span class="LC_nobreak"><label>'.&mt('New Secret').':'.
+                                      '<input type="password" size="20" name="lti_secret_'.$i.'" value="" autocomplete="new-password" /></label>'.
+                                      ' <label><input type="checkbox" name="lti_visible_'.$i.'" id="lti_visible_'.$i.'" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label></span></div>';
                     } else {
                         $datatable .=
-                            '<span class="LC_nobreak">'.$lt{'secret'}.':'.
-                            '<input type="password" size="20" name="lti_secret_'.$i.'" value="" autocomplete="new-password" />'.
-                            '<label><input type="checkbox" name="lti_visible_'.$i.'" id="lti_visible_'.$i.'" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label>';
+                            '<span class="LC_nobreak"><label>'.$lt{'secret'}.':'.
+                            '<input type="password" size="20" name="lti_secret_'.$i.'" value="" autocomplete="new-password" /></label>'.
+                            ' <label><input type="checkbox" name="lti_visible_'.$i.'" id="lti_visible_'.$i.'" onclick="if (this.checked) { this.form.lti_secret_'.$i.'.type='."'text'".' } else { this.form.lti_secret_'.$i.'.type='."'password'".' }" />'.&mt('Visible input').'</label></span>';
                     }
                 }
                 $datatable .= '<br /><br />'.
@@ -6327,7 +6584,7 @@
                     '<label><input type="radio" name="lti_crsinc_'.$i.'" value="1"'.$onclickcrsinc.$checkedcrsinc{yes}.' />'.&mt('Yes').'</label> '."\n".
                     '<label><input type="radio" name="lti_crsinc_'.$i.'" value="0"'.$onclickcrsinc.$checkedcrsinc{no}.' />'.&mt('No').'</label></span>'."\n".
                     (' 'x4).
-                    '<input type="hidden" name="lti_id_'.$i.'" value="'.$item.'" /></span>'.
+                    '<input type="hidden" name="lti_id_'.$i.'" value="'.$item.'" />'.
                     '</fieldset>'.&lti_options($i,$current,$itemcount,%lt).'</td></tr>';
                 $itemcount ++;
             }
@@ -6336,7 +6593,7 @@
         my $chgstr = ' onchange="javascript:reorderLTI(this.form,'."'lti_pos_add'".');"';
         $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n".
                       '<input type="hidden" name="lti_maxnum" value="'.$maxnum.'" />'."\n".
-                      '<select name="lti_pos_add"'.$chgstr.'>';
+                      '<select name="lti_pos_add"'.$chgstr.' aria-label="'.&mt('Set list order for new LTI consumer').'">';
         for (my $k=0; $k<$maxnum+1; $k++) {
             my $vpos = $k+1;
             my $selstr;
@@ -6346,23 +6603,23 @@
             $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
         }
         $datatable .= '</select> '."\n".
-                      '<input type="checkbox" name="lti_add" value="1" />'.&mt('Add').'</span></td>'."\n".
+                      '<label><input type="checkbox" name="lti_add" value="1" />'.&mt('Add').'</label></span></td>'."\n".
                       '<td colspan="2">'.
                       '<fieldset><legend>'.&mt('Required settings').'</legend>'.
-                      '<span class="LC_nobreak">'.$lt{'consumer'}.
-                      ':<input type="text" size="15" name="lti_consumer_add" value="" /></span> '."\n".
+                      '<span class="LC_nobreak"><label>'.$lt{'consumer'}.
+                      ':<input type="text" size="15" name="lti_consumer_add" value="" /></label></span> '."\n".
                       (' 'x2).
-                      '<span class="LC_nobreak">'.$lt{'version'}.':<select name="lti_version_add">'.
+                      '<span class="LC_nobreak"><label for="lti_version_add">'.$lt{'version'}.'</label>:<select name="lti_version_add" id="lti_version_add">'.
                       '<option value="LTI-1p0" selected="selected">1.1</option></select></span> '."\n".
                       (' 'x2).
-                      '<span class="LC_nobreak">'.$lt{'lifetime'}.':<input type="text" size="3" name="lti_lifetime_add" value="300" /></span><br /><br />'."\n";
+                      '<span class="LC_nobreak"><label>'.$lt{'lifetime'}.':<input type="text" size="3" name="lti_lifetime_add" value="300" /></label></span><br /><br />'."\n";
         if ($switchserver) {
             $datatable .= '<span class="LC_nobreak">'.&mt('Key and Secret are required').' - '.$switchmessage.'</span>'."\n";
         } else {
-            $datatable .= '<span class="LC_nobreak">'.$lt{'key'}.':<input type="text" size="25" name="lti_key_add" value="" autocomplete="off" /></span> '."\n".
+            $datatable .= '<span class="LC_nobreak"><label>'.$lt{'key'}.':<input type="text" size="25" name="lti_key_add" value="" autocomplete="off" /></label></span> '."\n".
                           (' 'x2).
-                          '<span class="LC_nobreak">'.$lt{'secret'}.':<input type="password" size="20" name="lti_secret_add" value="" autocomplete="new-password" />'.
-                          '<label><input type="checkbox" name="lti_add_visible" id="lti_add_visible" onclick="if (this.checked) { this.form.lti_secret_add.type='."'text'".' } else { this.form.lti_secret_add.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n";
+                          '<span class="LC_nobreak"><label>'.$lt{'secret'}.':<input type="password" size="20" name="lti_secret_add" value="" autocomplete="new-password" /></label>'.
+                          ' <label><input type="checkbox" name="lti_add_visible" id="lti_add_visible" onclick="if (this.checked) { this.form.lti_secret_add.type='."'text'".' } else { this.form.lti_secret_add.type='."'password'".' }" />'.&mt('Visible input').'</label></span> '."\n";
         }
         $datatable .= '<br /><br />'.
                       '<span class="LC_nobreak">'.$lt{'requser'}.':'.
@@ -6428,7 +6685,7 @@
     my $optionsty = 'block';
     my $crssty = 'block';
     my $lcauthparm;
-    my $lcauthparmstyle = 'display:none';
+    my $lcauthparmstyle = 'display: none;';
     my $lcauthparmtext;
     my $menusty;
     my $numinrow = 4;
@@ -6583,9 +6840,9 @@
                  '<label><input type="radio" name="lti_callback_'.$num.'" value="1"'.
                  $checked{'callback'}{'Y'}.$onclickcallback.' />'.&mt('Yes').'</label></span></div>'.
                  '<div class="LC_floatleft" style="display:'.$callbacksty.';" id="lti_callbackfield_'.$num.'">'.
-                 '<span class="LC_nobreak">'.&mt('Parameter').': '.
-                 '<input type="text" name="lti_callbackparam_'.$num.'" value="'.$callback.'" /></span>'.
-                 '</div><div style="padding:0;clear:both;margin:0;border:0"></div></fieldset>'.
+                 '<span class="LC_nobreak"><label>'.&mt('Parameter').': '.
+                 '<input type="text" name="lti_callbackparam_'.$num.'" value="'.$callback.'" /></label></span>'.
+                 '</div><div style="padding:0;clear:both;margin:0;border:0;"></div></fieldset>'.
                  '<fieldset class="ltioption_usr_'.$num.'" style="display:'.$optionsty.'"><legend>'.&mt('Mapping users').'</legend>'.
                  '<div class="LC_floatleft"><span class="LC_nobreak">'.&mt('LON-CAPA username').': ';
     foreach my $option ('sourcedid','email','other') {
@@ -6596,8 +6853,8 @@
     $output .= '</span></div>'.
                '<div class="LC_floatleft" style="display:'.$userfieldsty.';" id="lti_userfield_'.$num.'">'.
                '<input type="text" name="lti_customuser_'.$num.'" '.
-               'value="'.$userfield.'" /></div></fieldset>'.
-               '<fieldset class="ltioption_usr_'.$num.'" style="display:'.$optionsty.'"><legend>'.&mt('Roles which may create user accounts').'</legend>';
+               'value="'.$userfield.'" aria-label="'.&mt('username item in LTI payload').'" /></div></fieldset>'.
+               '<fieldset class="ltioption_usr_'.$num.'" style="display:'.$optionsty.'; line-height: 185%;"><legend>'.&mt('Roles which may create user accounts').'</legend>';
     foreach my $ltirole (@ltiroles) {
         $output .= '<span class="LC_nobreak"><label><input type="checkbox" name="lti_makeuser_'.$num.'" value="'.$ltirole.'"'.
                    $checked{'makeuser'}{$ltirole}.' />'.$ltirole.'</label> </span> ';
@@ -6607,7 +6864,7 @@
                '<table>'.
                &modifiable_userdata_row('lti','instdata_'.$num,$current,$numinrow,$itemcount).
                '</table>'.
-               '<table class="LC_nested"><tr><td class="LC_left_item">LON-CAPA Authentication</td>'.
+               '<table class="LC_nested"><tr><th class="LC_rowheader LC_left_item" scope="row">LON-CAPA Authentication</th>'.
                '<td class="LC_left_item">';
     foreach my $auth ('lti', at authtypes) {
         my $authtext;
@@ -6624,7 +6881,7 @@
                '<tr id="lti_lcauth_parmrow_'.$num.'" style="'.$lcauthparmstyle.'">'.
                '<td class="LC_right_item" colspan="2"><span class="LC_nobreak">'.
                '<span id="lti_lcauth_parmtext_'.$num.'">'.$lcauthparmtext.'</span>'.
-               '<input type="text" name="lti_lcauthparm_'.$num.'" value="" /></span></td></tr>'.
+               '<input type="text" name="lti_lcauthparm_'.$num.'" value="" aria-label="'.&mt('LON-CAPA Authentication parameter').'" /></span></td></tr>'.
                '</table></fieldset>'.
                '<fieldset class="ltioption_usr_'.$num.'" style="display:'.$optionsty.'"><legend>'.
                &mt('LON-CAPA menu items (Course Coordinator can override)').'</legend>'.
@@ -6657,7 +6914,7 @@
                    ($option eq 'other' ? '' : (' 'x2) );
     }
     $output .= '</span></div><div class="LC_floatleft" style="display:'.$crsfieldsty.';" id="lti_crsfield_'.$num.'">'.
-               '<input type="text" name="lti_mapcrsfield_'.$num.'" value="'.$cidfield.'" />'.
+               '<input type="text" name="lti_mapcrsfield_'.$num.'" value="'.$cidfield.'" aria-label="'.&mt('course identifier in LTI payload').'" />'.
                '</div><div style="padding:0;clear:both;margin:0;border:0"></div>'.
                '<span class="LC_nobreak">'.&mt('LON-CAPA course type(s)').': ';
     foreach my $type (@coursetypes) {
@@ -6672,14 +6929,17 @@
                '<label><input type="radio" name="lti_storecrs_'.$num.'" value="1"'.
                $checked{'storecrs'}{'Y'}.' />'.&mt('Yes').'</label></span>'.
                '</fieldset>'.
-               '<fieldset class="ltioption_crs_'.$num.'" style="display:'.$crssty.'"><legend>'.&mt('Mapping course roles').'</legend><table><tr>';
+               '<fieldset class="ltioption_crs_'.$num.'" style="display:'.$crssty.'">'.
+               '<legend>'.&mt('Mapping course roles').'</legend>'.
+               '<div class="LC_grid" role="grid" style="margin: 0;">'.
+	       '<div class="LC_grid_row" role="row">';
     foreach my $ltirole (@lticourseroles) {
         my ($selected,$selectnone);
         if ($rolemaps{$ltirole} eq '') {
             $selectnone = ' selected="selected"';
         }
-        $output .= '<td style="text-align: center">'.$ltirole.'<br />'.
-                   '<select name="lti_maprole_'.$ltirole.'_'.$num.'">'.
+        $output .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.$ltirole.'<br />'.
+                   '<select name="lti_maprole_'.$ltirole.'_'.$num.'" aria-label="'.$ltirole.'">'.
                    '<option value=""'.$selectnone.'>'.&mt('Select').'</option>';
         foreach my $role (@courseroles) {
             unless ($selectnone) {
@@ -6693,9 +6953,9 @@
                        &Apache::lonnet::plaintext($role,'Course').
                        '</option>';
         }
-        $output .= '</select></td>';
+        $output .= '</select></div>';
     }
-    $output .= '</tr></table></fieldset>'.
+    $output .= '</div></div></fieldset>'.
                '<fieldset class="ltioption_crs_'.$num.'" style="display:'.$crssty.'"><legend>'.&mt('Creating courses').'</legend>'.
                '<span class="LC_nobreak">'.&mt('Course created (if absent) on Instructor access').': '.
                '<label><input type="radio" name="lti_makecrs_'.$num.'" value="0"'.
@@ -6723,7 +6983,7 @@
                '<label><input type="radio" name="lti_crssecsrc_'.$num.'" value="other"'.
                $checked{'crssecsrc'}{'other'}.$onclicksecsrc.' />'.&mt('Other').
                '</label></span></div><div class="LC_floatleft" style="display:'.$secsrcfieldsty.';" id="lti_secsrcfield_'.$num.'">'.
-               '<input type="text" name="lti_customsection_'.$num.'" value="'.$crssecsrc.'" />'.
+               '<input type="text" name="lti_customsection_'.$num.'" value="'.$crssecsrc.'" aria-label="'.&mt('section identifier in LTI payload').'" />'.
                '</div><div style="padding:0;clear:both;margin:0;border:0"></div>';
     my ($pb1p1chk,$pb1p0chk,$onclickpb);
     foreach my $extra ('roster','passback') {
@@ -6762,7 +7022,7 @@
                '<label><input type="radio" name="lti_passbackformat_'.$num.'" value="1.0"'.$pb1p0chk.'/>'.
                &mt('Outcomes Extension (1.0)').'</label></span></div>'.
                '<div style="padding:0;clear:both;margin:0;border:0"></div></fieldset>';
-    $output .= '</span></div></fieldset>';
+	       #    $output .= '</span></div></fieldset>';
 #        '<fieldset><legend>'.&mt('Assigning author roles').'</legend>';
 #
 #    $output .= '</fieldset>'.
@@ -6806,10 +7066,10 @@
                 '<label><input type="checkbox" name="linkprot_suggested_del" value="'.$i.'" />'."\n".
                 &mt('Delete?').'</label></span></td><td>'."\n".
                 '<div class="LC_floatleft"><fieldset><legend>'.$lt{'name'}.'</legend>'."\n".
-                '<input type="text" size="15" name="linkprot_suggested_name_'.$i.'" value="'.$values{'name'}.'" autocomplete="off" />'."\n".
+                '<input type="text" size="15" name="linkprot_suggested_name_'.$i.'" value="'.$values{'name'}.'" autocomplete="off" aria-label="'.$lt{'name'}.'" />'."\n".
                 '</fieldset></div>'.
                 '<div class="LC_floatleft"><fieldset><legend>'.$lt{'info'}.'</legend>'."\n".
-                '<textarea cols="55" rows="5" name="linkprot_suggested_info_'.$i.'">'.$values{'info'}.'</textarea>'.
+                '<textarea cols="55" rows="5" name="linkprot_suggested_info_'.$i.'" aria-label="'.$lt{'info'}.'">'.$values{'info'}.'</textarea>'.
                 '</fieldset></div>'.
                 '<div style="padding:0;clear:both;margin:0;border:0"></div>'."\n".
                 '<input type="hidden" name="linkprot_suggested_id_'.$i.'" value="'.$num.'" /></td></tr>'."\n";
@@ -6819,13 +7079,13 @@
     $css_class = $$itemcount%2?' class="LC_odd_row"':'';
     $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'."\n".
                   '<input type="hidden" name="linkprot_suggested_maxnum" value="'.$next.'" />'."\n".
-                  '<input type="checkbox" name="linkprot_suggested_add" value="1" />'.&mt('Add').'</span></td>'."\n".
+                  '<label><input type="checkbox" name="linkprot_suggested_add" value="1" />'.&mt('Add').'</label></span></td>'."\n".
                   '<td>'."\n".
                   '<div class="LC_floatleft"><fieldset><legend>'.$lt{'name'}.'</legend>'."\n".
-                  '<input type="text" size="15" name="linkprot_suggested_name_add" value="" autocomplete="off" />'."\n".
+                  '<input type="text" size="15" name="linkprot_suggested_name_add" value="" autocomplete="off" aria-label="'.$lt{'name'}.'"/>'."\n".
                   '</fieldset></div>'.
                   '<div class="LC_floatleft"><fieldset><legend>'.$lt{'info'}.'</legend>'."\n".
-                  '<textarea cols="55" rows="5" name="linkprot_suggested_info_add"></textarea>'.
+                  '<textarea cols="55" rows="5" name="linkprot_suggested_info_add" aria-label="'.$lt{'info'}.'"></textarea>'.
                   '</fieldset></div>'.
                   '<div style="padding:0;clear:both;margin:0;border:0"></div>'."\n".
                   '</td></tr>'."\n";
@@ -6838,6 +7098,7 @@
     my $itemcount = 1;
     my %choices =  &Apache::lonlocal::texthash (
         canuse_pdfforms      => 'Course/Community users can create/upload PDF forms',
+        maxsizepdfform       => 'Maximum upload size for a fillable forms PDF (MB)',
         uploadquota          => 'Default quota for files uploaded directly to course/community using Course Editor (MB)',
         coursequota          => 'Default cumulative quota for all group portfolio spaces in course (MB)',
         anonsurvey_threshold => 'Responder count needed before showing submissions for anonymous surveys',
@@ -6864,30 +7125,38 @@
                            domexttool           => 1,
                            exttool              => 0,
                            crsauthor            => 1,
-                           crseditors           => ['edit','xml'],  
+                           crseditors           => ['edit','xml'],
+                           maxsizepdfform       => 5,
                          );
     if ($position eq 'top') {
         %defaultchecked = (
-                            'canuse_pdfforms' => 'off',
                             'uselcmath'       => 'on',
                             'usejsme'         => 'on',
                             'inline_chem'     => 'on',
                             'canclone'        => 'none',
                           );
-        @toggles = ('canuse_pdfforms','uselcmath','usejsme','inline_chem');
+        @toggles = ('uselcmath','usejsme','inline_chem');
         my $deftex = $Apache::lonnet::deftex;
+        my %checkedpdf = (
+                             0 => ' checked="checked"',
+                         );
         if (ref($settings) eq 'HASH') {
             if ($settings->{'texengine'}) {
                 if ($settings->{'texengine'} =~ /^(MathJax|mimetex|tth)$/) {
                     $deftex = $settings->{'texengine'};
                 }
             }
+            if ($settings->{'canuse_pdfforms'} =~ /^1|2$/) {
+                delete($checkedpdf{0});
+                $checkedpdf{$settings->{'canuse_pdfforms'}} = ' checked="checked"';
+            }
         }
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         my $mathdisp = '<tr'.$css_class.'><td style="vertical-align: top">'.
-                       '<span class="LC_nobreak">'.$choices{'texengine'}.
+                       '<span class="LC_nobreak">'.
+                       '<label for="texengine">'.$choices{'texengine'}.'</label>'.
                        '</span></td><td class="LC_right_item">'.
-                       '<select name="texengine">'."\n";
+                       '<select name="texengine" id="texengine">'."\n";
         my %texoptions = (
                             MathJax  => 'MathJax',
                             mimetex  => &mt('Convert to Images'),
@@ -6905,11 +7174,48 @@
         ($datatable,$itemcount) = &radiobutton_prefs($settings,\@toggles,\%defaultchecked,
                                                      \%choices,$itemcount);
         $datatable = $mathdisp.$datatable;
+        my $currmaxsizepdf = $settings->{'maxsizepdfform'};
+        if ($currmaxsizepdf eq '') {
+            $currmaxsizepdf = $staticdefaults{'maxsizepdfform'};
+        }
+        $css_class = $itemcount%2?' class="LC_odd_row"':'';
+        my %pdftext = &Apache::lonlocal::texthash (
+                        2 => 'Yes, including checkboxes',
+                        1 => 'Yes, excluding checkboxes',
+                        0 => 'No',
+        );
+        $datatable .=
+                '<tr'.$css_class.'><td><span class="LC_nobreak">'.
+                $choices{'canuse_pdfforms'}.
+                '</span></td>'.
+                '<td class="LC_left_item">'.
+                '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                '<legend class="LC_visually_hidden">'.$choices{'canuse_pdfforms'}.'</legend>'.
+		'<span class="LC_nobreak">';
+        foreach my $option ('2','1','0') {
+            $datatable .= '<label><input type="radio" name="canuse_pdfforms"'.
+                          ' value="'.$option.'"'.$checkedpdf{$option}.' />'.
+                          $pdftext{$option}.'</label>'.($option? '<br />' : '');
+        }
+        $datatable .= '</span></fieldset></td></tr>'."\n";
+        $itemcount ++;
+        $css_class = $itemcount%2?' class="LC_odd_row"':'';
+        $datatable .=
+                '<tr'.$css_class.'><td><span class="LC_nobreak">'.
+                '<label for="maxsizepdfform">'.$choices{'maxsizepdfform'}.
+                '</label></span></td>'.
+                '<td class="LC_left_item"><span class="LC_nobreak">'.
+                '<input type="text" name="maxsizepdfform" id="maxsizepdfform"'.
+                ' value="'.$currmaxsizepdf.'" size="5" /></span>'.
+                '</td></tr>'."\n";
+        $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .=
             '<tr'.$css_class.'><td style="vertical-align: top">'.
             '<span class="LC_nobreak">'.$choices{'canclone'}.
-            '</span></td><td class="LC_left_item">';
+            '</span></td><td class="LC_left_item">'.
+            '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+            '<legend class="LC_visually_hidden">'.$choices{'canclone'}.'</legend>';
         my $currcanclone = 'none';
         my $onclick;
         my @cloneoptions = ('none','domain');
@@ -6973,7 +7279,8 @@
                 ' value="'.$option.'"'.$onclick.' />'.$clonetitles{$option}.
                 '</label> '.$additional.'</span><br />';
         }
-        $datatable .= '</td>'.
+        $datatable .= '</fieldset>'.
+                      '</td>'.
                       '</tr>';
         $itemcount ++;
     } else {
@@ -7116,10 +7423,10 @@
         }
         $datatable .=
                 '<tr'.$css_class.'><td><span class="LC_nobreak">'.
-                $choices{'anonsurvey_threshold'}.
-                '</span></td>'.
+                '<label for="anonsurvey_threshold">'.$choices{'anonsurvey_threshold'}.
+                '</label></span></td>'.
                 '<td class="LC_right_item"><span class="LC_nobreak">'.
-                '<input type="text" name="anonsurvey_threshold"'.
+                '<input type="text" name="anonsurvey_threshold" id="anonsurvey_threshold"'.
                 ' value="'.$currdefresponder.'" size="5" /></span>'.
                 '</td></tr>'."\n";
         $itemcount ++;
@@ -7127,27 +7434,33 @@
         $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
                       $choices{'uploadquota'}.
                       '</span></td>'.
-                      '<td style="text-align: right" class="LC_right_item">'.
-                      '<table><tr>';
+                      '<td style="text-align: left" class="LC_right_left">'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$choices{'uploadquota'}.'</legend>'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
-            $datatable .= '<td style="text-align: center">'.&mt($type).'<br />'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                          '<label>'.&mt($type).'<br />'.
                            '<input type="text" name="uploadquota_'.$type.'"'.
-                           ' value="'.$curruploadquota{$type}.'" size="5" /></td>';
+                           ' value="'.$curruploadquota{$type}.'" size="5" /></label></div>';
         }
-        $datatable .= '</tr></table></td></tr>'."\n";
+        $datatable .= '</div></div></fieldset></td></tr>'."\n";
         $itemcount ++;
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
                       $choices{'coursequota'}.
                       '</span></td>'.
                       '<td style="text-align: right" class="LC_right_item">'.
-                      '<table><tr>';
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
-            $datatable .= '<td style="text-align: center">'.&mt($type).'<br />'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                          '<label>'.&mt($type).'<br />'.
                            '<input type="text" name="coursequota_'.$type.'"'.
-                           ' value="'.$currcoursequota{$type}.'" size="5" /></td>';
+                           ' value="'.$currcoursequota{$type}.'" size="5" /></label></div>';
         }
-        $datatable .= '</tr></table></td></tr>'."\n";
+        $datatable .= '</div></div></td></tr>'."\n";
         $itemcount ++;
         my $onclick = "toggleDisplay(this.form,'credits');";
         my $display = 'none';
@@ -7155,14 +7468,17 @@
             $display = 'block';
         }
         my $additional = '<div id="credits" style="display: '.$display.'">'.
-                         '<i>'.&mt('Default credits').'</i><br /><table><tr>';
+                         '<i>'.&mt('Default credits').'</i><br />'.
+                         '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                         '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
             next if ($type eq 'community');
-            $additional .= '<td style="text-align: center">'.&mt($type).'<br />'.
+            $additional .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                           '<label>'.&mt($type).'<br />'.
                            '<input type="text" name="'.$type.'_credits"'.
-                           ' value="'.$defcredits{$type}.'" size="3" /></td>';
+                           ' value="'.$defcredits{$type}.'" size="3" /></label></div>';
         }
-        $additional .= '</tr></table></div>'."\n";
+        $additional .= '</div></div></div>'."\n";
         %defaultchecked = ('coursecredits' => 'off');
         @toggles = ('coursecredits');
         my $current = {
@@ -7170,7 +7486,7 @@
                       };
         (my $table,$itemcount) =
             &radiobutton_prefs($current,\@toggles,\%defaultchecked,
-                               \%choices,$itemcount,$onclick,$additional,'left');
+                               \%choices,$itemcount,$onclick,$additional,'left','',185);
         $datatable .= $table;
         $onclick = "toggleDisplay(this.form,'studentsubmission');";
         my $display = 'none';
@@ -7180,13 +7496,15 @@
         $additional = '<div id="studentsubmission" style="display: '.$display.'">'.
                       &mt('Number of seconds submit is disabled').'<br />'.
                       '<i>'.&mt('Enter 0 to remain disabled until page reload.').'</i><br />'.
-                      '<table><tr>';
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
-            $additional .= '<td style="text-align: center">'.&mt($type).'<br />'.
+            $additional .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                           '<label>'.&mt($type).'<br />'.
                            '<input type="text" name="'.$type.'_timeout" value="'.
-                           $deftimeout{$type}.'" size="5" /></td>';
+                           $deftimeout{$type}.'" size="5" /></label></div>';
         }
-        $additional .= '</tr></table></div>'."\n";
+        $additional .= '</div></div></div>'."\n";
         %defaultchecked = ('postsubmit' => 'on');
         @toggles = ('postsubmit');
         $current = {
@@ -7194,20 +7512,22 @@
                    };
         ($table,$itemcount) =
             &radiobutton_prefs($current,\@toggles,\%defaultchecked,
-                               \%choices,$itemcount,$onclick,$additional,'left');
+                               \%choices,$itemcount,$onclick,$additional,'left','',185);
         $datatable .= $table;
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
                       $choices{'mysqltables'}.
                       '</span></td>'.
                       '<td style="text-align: right" class="LC_right_item">'.
-                      '<table><tr>';
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
-            $datatable .= '<td style="text-align: center">'.&mt($type).'<br />'.
-                           '<input type="text" name="mysqltables_'.$type.'"'.
-                           ' value="'.$currmysql{$type}.'" size="8" /></td>';
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: center">'.
+                          '<label>'.&mt($type).'<br />'.
+                          '<input type="text" name="mysqltables_'.$type.'"'.
+                          ' value="'.$currmysql{$type}.'" size="8" /></label></div>';
         }
-        $datatable .= '</tr></table></td></tr>'."\n";
+        $datatable .= '</div></div></td></tr>'."\n";
         $itemcount ++;
         %defaultchecked = ('ltiauth' => 'off');
         @toggles = ('ltiauth');
@@ -7223,62 +7543,74 @@
                       $choices{'domexttool'}.
                       '</span></td>'.
                       '<td style="text-align: right" class="LC_right_item">'.
-                      '<table><tr>';
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$choices{'domexttool'}.'</legend>'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
-            $datatable .= '<td style="text-align: left">'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: left">'.
                           '<span class="LC_nobreak">'.
                           '<label><input type="checkbox" name="domexttool"'.
                           ' value="'.$type.'"'.$domexttool{$type}.' />'.
-                          &mt($type).'</label></span></td>'."\n";
+                          &mt($type).'</label></span></div>'."\n";
         }
-        $datatable .= '</tr></table></td></tr>'."\n";
+        $datatable .= '</div></div></fieldset></td></tr>'."\n";
         $itemcount ++;
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
                       $choices{'exttool'}.
                       '</span></td>'.
                       '<td style="text-align: right" class="LC_right_item">'.
-                      '<table><tr>';
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$choices{'exttool'}.'</legend>'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
-            $datatable .= '<td style="text-align: left">'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: left">'.
                           '<span class="LC_nobreak">'.
                           '<label><input type="checkbox" name="exttool"'.
                           ' value="'.$type.'"'.$exttool{$type}.' />'.
-                          &mt($type).'</label></span></td>'."\n";
+                          &mt($type).'</label></span></div>'."\n";
         }
-        $datatable .= '</tr></table></td></tr>'."\n";
+        $datatable .= '</div></div></fieldset></td></tr>'."\n";
         $itemcount ++;
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
                       $choices{'crsauthor'}.
                       '</span></td>'.
                       '<td style="text-align: right" class="LC_right_item">'.
-                      '<table><tr>';
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$choices{'crsauthor'}.'</legend>'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         foreach my $type (@types) {
-            $datatable .= '<td style="text-align: left">'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: left">'.
                           '<span class="LC_nobreak">'.
                           '<label><input type="checkbox" name="crsauthor"'.
                           ' value="'.$type.'"'.$crsauthor{$type}.' />'.
-                          &mt($type).'</label></span></td>'."\n";
+                          &mt($type).'</label></span></div>'."\n";
         }
-        $datatable .= '</tr></table></td></tr>'."\n";
+        $datatable .= '</div></div></fieldset></td></tr>'."\n";
         $itemcount ++;
         $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
                       $choices{'crseditors'}.
                       '</span></td>'.
                       '<td style="text-align: right" class="LC_right_item">'.
-                      '<table><tr>';
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$choices{'crseditors'}.'</legend>'.
+                      '<div class="LC_grid" role="grid" style="margin: 0;">'.
+                      '<div class="LC_grid_row" role="row">';
         my @editors = ('edit','xml','daxe');
         my %editornames = &crseditor_titles();
         foreach my $editor (@editors) {
-            $datatable .= '<td style="text-align: left">'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell" style="text-align: left">'.
                           '<span class="LC_nobreak">'.
                           '<label><input type="checkbox" name="crseditors"'.
                           ' value="'.$editor.'"'.$crseditors{$editor}.' />'.
-                          $editornames{$editor}.'</label></span></td>'."\n";
+                          $editornames{$editor}.'</label></span></div>'."\n";
         }
-        $datatable .= '</tr></table></td></tr>'."\n";
+        $datatable .= '</div></div></fieldset></td></tr>'."\n";
     }
     $$rowtotal += $itemcount;
     return $datatable;
@@ -7321,18 +7653,18 @@
             }
         }
         $datatable .= '<tr'.$css_class.'><td style="vertical-align: top">'.
-                      '<span class="LC_nobreak">'.$titles{'copyright'}.
-                      '</span></td><td class="LC_right_item">'.
-                      &selectbox('copyright',$currrights{'copyright'},'',
+                      '<span class="LC_nobreak"><label for="copyright">'.$titles{'copyright'}.
+                      '</label></span></td><td class="LC_right_item">'.
+                      &selectbox('copyright','copyright',$currrights{'copyright'},'',
                                  \&Apache::loncommon::copyrightdescription,
                                  (grep !/^priv|custom$/,(&Apache::loncommon::copyrightids))).
                       '</td></tr>'."\n";
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td style="vertical-align: top">'.
-                      '<span class="LC_nobreak">'.$titles{'sourceavail'}.
-                      '</span></td><td class="LC_right_item">'.
-                      &selectbox('sourceavail',$currrights{'sourceavail'},'',
+                      '<span class="LC_nobreak"><label for="sourceavail">'.$titles{'sourceavail'}.
+                      '</label></span></td><td class="LC_right_item">'.
+                      &selectbox('sourceavail','sourceavail',$currrights{'sourceavail'},'',
                                  \&Apache::loncommon::source_copyrightdescription,
                                  (&Apache::loncommon::source_copyrightids)).
                       '</td></tr>'."\n";        
@@ -7355,6 +7687,8 @@
         $datatable = '<tr'.$css_class.'>'."\n".
                      '<td>'.$titles{'editors'}.'</td>'."\n".
                      '<td class="LC_left_item">'."\n".
+                     '<fieldset class="LC_borderless">'."\n".
+                     '<legend class="LC_visually_hidden">'.$titles{'editors'}.'</legend>'."\n".
                      '<span class="LC_nobreak">';
         foreach my $editor (@editors) {
             my $checked;
@@ -7367,7 +7701,7 @@
                           'onclick="javascript:checkEditors(this.form,'."'author_editors'".',this);" />'.
                           $titles{$editor}.'</label> ';
         }
-        $datatable .= '</span>'."\n".'</td>'."\n".'</tr>'."\n";
+        $datatable .= '</span></fieldset>'."\n".'</td>'."\n".'</tr>'."\n";
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         my ($othertitle,$usertypes,$types) = &Apache::loncommon::sorted_inst_types($dom);
@@ -7436,7 +7770,9 @@
                       '<td>'.$titles{'webdav_LC_adv'}.'<br />'.
                              $titles{'webdav_LC_adv_over'}.
                       '</td>'.
-                      '<td class="LC_left_item">';
+                      '<td class="LC_left_item">'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$titles{'webdav_LC_adv'}.'</legend>';
         foreach my $option ('none','off','on') {
             my ($text,$val,$checked);
             if ($option eq 'none') {
@@ -7457,7 +7793,7 @@
                           ' value="'.$val.'"'.$checked.' />'.
                           $text.'</label></span>  ';
         }
-        $datatable .= '</td></tr>';
+        $datatable .= '</fieldset></td></tr>';
         $itemcount ++;
         my %defchecked = (
                                 'archive' => 'off',
@@ -7496,17 +7832,21 @@
 }
 
 sub selectbox {
-    my ($name,$value,$readonly,$functionref, at idlist)=@_;
-    my $selout = '<select name="'.$name.'">';
-    foreach my $id (@idlist) {
-        $selout.='<option value="'.$id.'"';
-        if ($id eq $value) {
+    my ($name,$id,$value,$readonly,$functionref, at idlist)=@_;
+    my $selout = '<select name="'.$name.'"';
+    if ($id ne '') {
+        $selout .= ' id="'.$id.'"';    
+    }
+    $selout .= '>'; 
+    foreach my $lid (@idlist) {
+        $selout.='<option value="'.$lid.'"';
+        if ($lid eq $value) {
             $selout.=' selected="selected"';
         }
         if ($readonly) {
             $selout .= ' disabled="disabled"';
         }
-        $selout.='>'.&{$functionref}($id).'</option>';
+        $selout.='>'.&{$functionref}($lid).'</option>';
     }
     $selout.='</select>';
     return $selout;
@@ -7536,7 +7876,7 @@
                 $itemcount ++;
                 $css_class = $itemcount%2?' class="LC_odd_row"':'';
                 $datatable .= '<tr'.$css_class.'>'.
-                              '<td>'.$titlesref->{$row}.'</td>'.
+                              '<th scope="row" class="LC_rowheader">'.$titlesref->{$row}.'</th>'.
                               '<td class="LC_left_item">'.
                               '<table><tr>';
                 my (%current,%currentcap);
@@ -7559,20 +7899,22 @@
                             ); 
             
                 foreach my $type (@types) {
-                    unless (($row eq 'registered') && ($key eq 'default')) {
+		    unless (($row eq 'registered') && ($type ne 'official')) {
                         $datatable .= '<th>'.&mt($type).'</th>';
                     }
                 }
-                unless (($row eq 'registered') && ($key eq 'default')) {
-                    $datatable .= '</tr><tr>';
-                }
+                $datatable .= '</tr><tr>';
                 foreach my $type (@types) {
                     if ($type eq 'community') {
                         $roles{'1'} = &mt('Community personnel');
                     } else {
                         $roles{'1'} = &mt('Course personnel');
                     }
-                    $datatable .= '<td style="vertical-align: top">';
+                    next if (($row eq 'registered') && ($type ne 'official'));
+                    $datatable .= '<td style="vertical-align: top">'.
+                                  '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                                  '<legend class="LC_visually_hidden">'.
+                                  $titlesref->{$row}.' ['.&mt($type).']</legend>'; 
                     if ($position eq 'top') {
                         my %checked;
                         if ($current{$type} eq '0') {
@@ -7580,11 +7922,15 @@
                         } else {
                             $checked{'1'} = ' checked="checked"';
                         }
+                        my $linefeed;
+                        if ($row eq 'registered') {
+                            $linefeed = '<br />';
+                        }
                         foreach my $role ('1','0') {
                             $datatable .= '<span class="LC_nobreak"><label>'.
                                           '<input type="radio" name="selfenrolladmin_'.$row.'_'.$type.'" '.
                                           'value="'.$role.'"'.$checked{$role}.' />'.
-                                          $roles{$role}.'</label></span> ';
+                                          $roles{$role}.'</label></span> '.$linefeed;
                         }
                     } else {
                         if ($row eq 'types') {
@@ -7600,16 +7946,18 @@
                                               'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span> ';
                             }
                         } elsif ($row eq 'registered') {
-                            my %checked;
-                            if ($current{$type} eq '1') {
-                                $checked{'1'} = ' checked="checked"';
-                            } else {
-                                $checked{'0'} = ' checked="checked"';
-                            }
-                            foreach my $val ('0','1') {
-                                $datatable .= '<span class="LC_nobreak"><label>'.
-                                              '<input type ="radio" name="selfenrolldefault_'.$row.'_'.$type.'" '.
-                                              'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span> ';
+                            if ($type eq 'official') {
+                                my %checked;
+                                if ($current{$type} eq '1') {
+                                    $checked{'1'} = ' checked="checked"';
+                                } else {
+                                    $checked{'0'} = ' checked="checked"';
+                                }
+                                foreach my $val ('0','1') {
+                                    $datatable .= '<span class="LC_nobreak"><label>'.
+                                                  '<input type ="radio" name="selfenrolldefault_'.$row.'_'.$type.'" '.
+                                                  'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span><br />';
+                                }
                             }
                         } elsif ($row eq 'approval') {
                             my %checked;
@@ -7640,12 +7988,12 @@
                                               'value="'.$val.'"'.$checked{$val}.' />'.$descs{$row}{$val}.'</label></span> ';
                             }
                             $datatable .= '<br />'.
-                                          '<span class="LC_nobreak">'.&mt('Maximum allowed: ').
-                                          '<input type="text" name="selfenrolldefault_cap_'.$type.'" size = "5" value="'.$cap.'" />'.
+                                          '<span class="LC_nobreak"><label>'.&mt('Maximum allowed: ').
+                                          '<input type="text" name="selfenrolldefault_cap_'.$type.'" size = "5" value="'.$cap.'" /></label>'.
                                           '</span>'; 
                         }
                     }
-                    $datatable .= '</td>';
+                    $datatable .= '</fieldset></td>';
                 }
                 $datatable .= '</tr>';
             }
@@ -7676,19 +8024,26 @@
     my $itemcount = 0;
     foreach my $item (@{$itemsref}) {
         my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
-        $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'.
-                      $namesref->{$item}.
-                      '</span></td>'.
+        $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">';
+        if ($item eq 'fields') {
+            $datatable .= $namesref->{$item};
+        } else {
+            $datatable .= '<label for="'.$caller.'_validation_'.$item.'">'.$namesref->{$item}.'</label>';
+        }
+        $datatable .= '</span></td>'.
                       '<td class="LC_left_item">';
         if (($item eq 'url') || ($item eq 'button')) {
             $datatable .= '<span class="LC_nobreak">'.
-                          '<input type="text" name="'.$caller.'_validation_'.$item.'"'.
-                          ' value="'.$currvalidation{$item}.'" size="50" /></span>';
+                          '<input type="text" name="'.$caller.'_validation_'.$item.'" '.
+                          'id="'.$caller.'_validation_'.$item.'" '.
+                          'value="'.$currvalidation{$item}.'" size="50" /></span>';
         } elsif ($item eq 'fields') {
             my @currfields;
             if (ref($currvalidation{$item}) eq 'ARRAY') {
                 @currfields = @{$currvalidation{$item}};
             }
+            $datatable .= '<fieldset class="LC_borderless">'.
+                          '<legend class="LC_visually_hidden">'.$namesref->{$item}.'</legend>';
             foreach my $field (@{$fieldsref}) {
                 my $check = '';
                 if (grep(/^\Q$field\E$/, at currfields)) {
@@ -7699,10 +8054,12 @@
                               ' value="'.$field.'"'.$check.' />'.$field.
                               '</label></span> ';
             }
+            $datatable .= '</fieldset>'; 
         } elsif ($item eq 'markup') {
-            $datatable .= '<textarea name="'.$caller.'_validation_markup" cols="50" rows="5">'.
+            $datatable .= '<textarea name="'.$caller.'_validation_markup" '.
+                          'id="'.$caller.'_validation_markup" cols="50" rows="5">'.
                            $currvalidation{$item}.
-                              '</textarea>';
+                           '</textarea>';
         }
         $datatable .= '</td></tr>'."\n";
         if (ref($rowtotal)) {
@@ -7719,8 +8076,9 @@
             }
         }
         my $numinrow = 2;
+        my $legend = &mt('Choose Dom. Coord. who will be listed as course creator');
         my ($numdc,$dctable,$rows) = &active_dc_picker($dom,$numinrow,'radio',
-                                                       'validationdc',%currhash);
+                                                       'validationdc',$legend,%currhash);
         my $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
         $datatable .= '<tr'.$css_class.'><td>';
         if ($numdc > 1) {
@@ -7832,7 +8190,8 @@
                 }
                 $css_class = $itemcount%2?' class="LC_odd_row"':'';
                 my ($numdc,$table,$rows) = &active_dc_picker($dom,$numinrow,'checkbox',
-                                                             'privacy_notify',%curr);
+                                                             'privacy_notify',$titles{'notify'},
+                                                             %curr);
                 if ($numdc > 0) {
                     $datatable .= $table;
                 } else {
@@ -7955,14 +8314,17 @@
         $datatable = &captcha_choice('passwords',$settings,$$rowtotal);
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
-        $datatable .= '<tr'.$css_class.'><td>'.$titles{'link'}.'</td>'.
+        $datatable .= '<tr'.$css_class.'><td>'.
+                      '<label for="passwords_link">'.$titles{'link'}.'</label></td>'.
                       '<td class="LC_left_item">'.
-                      '<input type="textbox" value="'.$shownlinklife.'" '.
-                      'name="passwords_link" size="3" /></td></tr>';
+                      '<input type="text" value="'.$shownlinklife.'" '.
+                      'name="passwords_link" id="passwords_link" size="3" /></td></tr>';
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'case'}.'</td>'.
-                      '<td class="LC_left_item">';
+                      '<td class="LC_left_item">'.
+                      '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                      '<legend class="LC_visually_hidden">'.$titles{'case'}.'</legend>';
         if ((ref($types) eq 'ARRAY') && (ref($usertypes) eq 'HASH')) {
             foreach my $item (@{$types}) {
                 my $checkedcase;
@@ -7981,7 +8343,7 @@
         }
         $datatable .= '<span class="LC_nobreak"><label><input type="checkbox" '.
                       'name="passwords_case_sensitive" value="default"'.$checkedcase.' />'.
-                      $othertitle.'</label></span></td>';
+                      $othertitle.'</label></span></fieldset></td></tr>';
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         my %checkedpre = (
@@ -7993,12 +8355,15 @@
             $checkedpre{both} = '';
         }
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'prelink'}.'</td>'.
-                      '<td class="LC_left_item"><span class="LC_nobreak">'.
+                      '<td class="LC_left_item">'.
+                      '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                      '<legend class="LC_visually_hidden">'.$titles{'prelink'}.'</legend>'.
+                      '<span class="LC_nobreak">'.
                       '<label><input type="radio" name="passwords_prelink" value="both"'.$checkedpre{'both'}.' />'.
                       &mt('Both username and e-mail address').'</label></span>   '.
                       '<span class="LC_nobreak"><label>'.
                       '<input type="radio" name="passwords_prelink" value="either"'.$checkedpre{'either'}.' />'.
-                      &mt('Either username or e-mail address').'</label></span></td></tr>';
+                      &mt('Either username or e-mail address').'</label></span></fieldset></td></tr>';
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'postlink'}.'</td>'.
@@ -8020,7 +8385,7 @@
                     $datatable .= '<span class="LC_nobreak"><label>'.
                                   '<input type="checkbox" name="passwords_postlink_'.$item.'" value="'.
                                   $field.'"'.$checked.' />'.$field.'</label>'.
-                                  '<span>   ';
+                                  '</span>   ';
                 }
                 $datatable .= '</fieldset>';
             }
@@ -8038,13 +8403,15 @@
             $datatable .= '<span class="LC_nobreak"><label>'.
                           '<input type="checkbox" name="passwords_postlink_default" value="'.
                           $field.'"'.$checked.' />'.$field.'</label>'.
-                          '<span>   ';
+                          '</span>   ';
         }
         $datatable .= '</fieldset></td></tr>';
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'emailsrc'}.'</td>'.
-                      '<td class="LC_left_item">';
+                      '<td class="LC_left_item">'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.$titles{'emailsrc'}.'</legend>';
         foreach my $type ('permanent','critical','notify') {
             my $checkedemail;
             if ($emailsrc{$type}) {
@@ -8053,9 +8420,9 @@
             $datatable .= '<span class="LC_nobreak"><label>'.
                           '<input type="checkbox" name="passwords_emailsrc" value="'.
                           $type.'"'.$checkedemail.' />'.$titles{$type}.'</label>'.
-                          '<span>   ';
+                          '</span>   ';
         }
-        $datatable .= '</td></tr>';
+        $datatable .= '</fieldset></td></tr>';
         $itemcount ++;
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
         my $switchserver = &check_switchserver($dom,$confname);
@@ -8066,15 +8433,18 @@
             $showstd = ' checked="checked"';
         }
         $datatable .= '<tr'.$css_class.'><td>'.$titles{'customtext'}.'</td>'.
-                      '<td class="LC_left_item"><span class="LC_nobreak">'.
-                      &mt('Retain standard text:').
+                      '<td class="LC_left_item">'.
+                      '<span class="LC_nobreak" aria-hidden="true">'.&mt('Retain standard text').':</span>'.
+                      '<fieldset class="LC_borderless">'.
+                      '<legend class="LC_visually_hidden">'.&mt('Retain standard text').'</legend>'.
+                      '<span class="LC_nobreak">'.
                       '<label><input type="radio" name="passwords_stdtext" value="1"'.$showstd.' />'.
                       &mt('Yes').'</label>'.' '.
                       '<label><input type="radio" name="passwords_stdtext" value="0"'.$noshowstd.' />'.
-                      &mt('No').'</label></span><br />'.
-                      '<span class="LC_fontsize_small">'.
+                      &mt('No').'</label></span></fieldset><br />'.
+                      '<span class="LC_fontsize_medium">'.
                       &mt('(If you use the same account ...  reset a password from this page.)').'</span><br /><br />'.
-                      &mt('Include custom text:');
+                      '<label for="passwords_customfile">'.&mt('Include custom text:').'</label>';
         if ($customurl) {
             my $link =  &Apache::loncommon::modal_link($customurl,&mt('custom text'),600,500,
                                                        undef,undef,undef,undef,'background-color:#ffffff');
@@ -8087,7 +8457,8 @@
             $datatable .= '<span class="LC_nobreak"> '.&mt('Upload to library server: [_1]',$switchserver).'</span>';
         } else {
             $datatable .='<span class="LC_nobreak"> '.
-                         '<input type="file" name="passwords_customfile" /></span>';
+                         '<input type="file" name="passwords_customfile" id="passwords_customfile" />'.
+                         '</span>';
         }
         $datatable .= '</td></tr>';
     } elsif ($position eq 'middle') {
@@ -8119,8 +8490,13 @@
                 $css_class = ' class="LC_odd_row" ';
             }
             $datatable .= '<tr'.$css_class.'>'.
-                          '<td><span class="LC_nobreak">'.$titles{$item}.
-                          '</span></td><td class="LC_left_item" colspan="3">';
+                          '<td><span class="LC_nobreak">';
+            if ($item eq 'intauth_cost') {
+                $datatable .= '<label for="'.$item.'">'.$titles{$item}.'</label>';
+            } else {
+                $datatable .= $titles{$item};
+            }
+            $datatable .= '</span></td><td class="LC_left_item" colspan="3">';
             if ($item eq 'intauth_switch') {
                 my @options = (0,1,2);
                 my %optiondesc = &Apache::lonlocal::texthash (
@@ -8128,18 +8504,22 @@
                                    1 => 'Yes',
                                    2 => 'Yes, and copy existing passwd file to passwd.bak file',
                                  );
-                $datatable .= '<table width="100%">';
+                $datatable .= '<fieldset class="LC_borderless" style="line-height: 185%; width: 100%;">'.
+                              '<legend class="LC_visually_hidden">'.$titles{$item}.'</legend>';
                 foreach my $option (@options) {
                     my $checked = ' ';
                     if ($defaults{$item} eq $option) {
                         $checked = ' checked="checked"';
                     }
-                    $datatable .= '<tr><td class="LC_left_item"><span class="LC_nobreak">'.
+                    $datatable .= '<span class="LC_left_item LC_nobreak">'.
                                   '<label><input type="radio" name="'.$item.
                                   '" value="'.$option.'"'.$checked.' />'.
-                                  $optiondesc{$option}.'</label></span></td></tr>';
+                                  $optiondesc{$option}.'</label></span>';
+                    unless ($option eq $options[-1]) {
+                        $datatable .= '<br />'; 
+                    }
                 }
-                $datatable .= '</table>';
+                $datatable .= '</fieldset>';
             } elsif ($item eq 'intauth_check') {
                 my @options = (0,1,2);
                 my %optiondesc = &Apache::lonlocal::texthash (
@@ -8147,7 +8527,8 @@
                                    1 => 'Yes, allow login then update passwd file using default cost (if higher)',
                                    2 => 'Yes, disallow login if stored cost is less than domain default',
                                  );
-                $datatable .= '<table width="100%">';
+                $datatable .= '<fieldset class="LC_borderless" style="line-height: 185%; width: 100%;">'.
+                              '<legend class="LC_visually_hidden">'.$titles{$item}.'</legend>';
                 foreach my $option (@options) {
                     my $checked = ' ';
                     my $onclick;
@@ -8157,14 +8538,17 @@
                     if ($option == 2) {
                         $onclick = ' onclick="javascript:warnIntAuth(this);"';
                     }
-                    $datatable .= '<tr><td class="LC_left_item"><span class="LC_nobreak">'.
+                    $datatable .= '<span class="LC_left_item LC_nobreak">'.
                                   '<label><input type="radio" name="'.$item.
                                   '" value="'.$option.'"'.$checked.$onclick.' />'.
-                                  $optiondesc{$option}.'</label></span></td></tr>';
+                                  $optiondesc{$option}.'</label></span>';
+                    unless ($option eq $options[-1]) {
+                        $datatable .= '<br />';
+                    }
                 }
-                $datatable .= '</table>';
+                $datatable .= '</fieldset>';
             } else {
-                $datatable .= '<input type="text" name="'.$item.'" value="'.
+                $datatable .= '<input type="text" name="'.$item.'" id="'.$item.'" value="'.
                               $defaults{$item}.'" size="3" onblur="javascript:warnIntAuth(this);" />';
             }
             $datatable .= '</td></tr>';
@@ -8277,28 +8661,31 @@
                                                  spec => 'At least one non-alphanumeric',
                                                );
     my $css_class = $itemcount%2?' class="LC_odd_row"':'';
-    $datatable .= '<tr'.$css_class.'><td>'.$titles{'min'}.'</td>'.
+    $datatable .= '<tr'.$css_class.'><td><label for="'.$prefix.'_min">'.$titles{'min'}.'</label></td>'.
                   '<td class="LC_left_item"><span class="LC_nobreak">'.
-                  '<input type="text" name="'.$prefix.'_min" value="'.$min.'" size="3" '.
+                  '<input type="text" name="'.$prefix.'_min" id="'.$prefix.'_min" value="'.$min.'" size="3" '.
                   'onblur="javascript:warnInt'.$prefix.'(this);" />'.
-                  '<span class="LC_fontsize_small"> '.&mt('(Enter an integer: 7 or larger)').'</span>'.
+                  '<span class="LC_fontsize_medium"> '.&mt('(Enter an integer: 7 or larger)').'</span>'.
                   '</span></td></tr>';
     $itemcount ++;
     $css_class = $itemcount%2?' class="LC_odd_row"':'';
-    $datatable .= '<tr'.$css_class.'><td>'.$titles{'max'}.'</td>'.
+    $datatable .= '<tr'.$css_class.'><td><label for="'.$prefix.'_max">'.$titles{'max'}.'</label></td>'.
                   '<td class="LC_left_item"><span class="LC_nobreak">'.
-                  '<input type="text" name="'.$prefix.'_max" value="'.$max.'" size="3" '.
+                  '<input type="text" name="'.$prefix.'_max" id="'.$prefix.'_max" value="'.$max.'" size="3" '.
                   'onblur="javascript:warnInt'.$prefix.'(this);" />'.
-                  '<span class="LC_fontsize_small"> '.&mt('(Leave blank for no maximum)').'</span>'.
+                  '<span class="LC_fontsize_medium"> '.&mt('(Leave blank for no maximum)').'</span>'.
                   '</span></td></tr>';
     $itemcount ++;
     $css_class = $itemcount%2?' class="LC_odd_row"':'';
     $datatable .= '<tr'.$css_class.'><td>'.$titles{'chars'}.'<br />'.
-                  '<span class="LC_nobreak LC_fontsize_small">'.&mt('(Leave unchecked if not required)').
+                  '<span class="LC_nobreak LC_fontsize_medium">'.&mt('(Leave unchecked if not required)').
                   '</span></td>';
     my $numinrow = 2;
     my @possrules = ('uc','lc','num','spec');
-    $datatable .= '<td class="LC_left_item"><table>';
+    $datatable .= '<td class="LC_left_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$titles{'chars'}.'</legend>'.
+                  '<div class="LC_grid" role="grid">';
     for (my $i=0; $i<@possrules; $i++) {
         my ($rem,$checked);
         if ($chars{$possrules[$i]}) {
@@ -8307,32 +8694,25 @@
         $rem = $i%($numinrow);
         if ($rem == 0) {
             if ($i > 0) {
-                $datatable .= '</tr>';
+                $datatable .= '</div>';
             }
-            $datatable .= '<tr>';
+            $datatable .= '<div class="LC_grid_row" role="row">';
         }
-        $datatable .= '<td><span class="LC_nobreak"><label>'.
+        $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
+                      '<span class="LC_nobreak"><label>'.
                       '<input type="checkbox" name="'.$prefix.'_chars" value="'.$possrules[$i].'"'.$checked.' />'.
-                      $rulenames{$possrules[$i]}.'</label></span></td>';
-    }
-    my $rem = @possrules%($numinrow);
-    my $colsleft = $numinrow - $rem;
-    if ($colsleft > 1 ) {
-        $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'.
-                      ' </td>';
-    } elsif ($colsleft == 1) {
-        $datatable .= '<td class="LC_left_item"> </td>';
+                      $rulenames{$possrules[$i]}.'</label></span></div>';
     }
-    $datatable .='</table></td></tr>';
+    $datatable .='</div></div></fieldset></td></tr>';
     $itemcount ++;
     if ($prefix eq 'passwords') {
         $titles{'numsaved'} = &mt('Number of previous passwords to save and disallow reuse');
         $css_class = $itemcount%2?' class="LC_odd_row"':'';
-        $datatable .= '<tr'.$css_class.'><td>'.$titles{'numsaved'}.'</td>'.
+        $datatable .= '<tr'.$css_class.'><td><label for="'.$prefix.'_numsaved">'.$titles{'numsaved'}.'</label></td>'.
                       '<td class="LC_left_item"><span class="LC_nobreak">'.
-                      '<input type="text" name="'.$prefix.'_numsaved" value="'.$numsaved.'" size="3" '.
+                      '<input type="text" name="'.$prefix.'_numsaved" id="'.$prefix.'_numsaved" value="'.$numsaved.'" size="3" '.
                       'onblur="javascript:warnInt'.$prefix.'(this);" />'.
-                      '<span class="LC_fontsize_small"> '.&mt('(Leave blank to not save previous passwords)').'</span>'.
+                      '<span class="LC_fontsize_medium"> '.&mt('(Leave blank to not save previous passwords)').'</span>'.
                       '</span></td></tr>';
         $itemcount ++;
     }
@@ -8410,12 +8790,12 @@
         foreach my $server (sort(keys(%servers))) {
             $itemcount ++;
             my $dom_in_effect;
-            my $aliasrows = '<tr>'.
-                            '<td class="LC_left_item" style="vertical-align: baseline;">'.
+            my $aliasrows = '<div class="LC_grid_row" role="row">'.
+                            '<div class="LC_grid_cell" style="text-align: left; vertical-align: baseline;">'.
                             &mt('Hostname').': '.
                             '<span class="LC_nobreak LC_cusr_emph">'.
                             &Apache::lonnet::hostname($server).
-                            '</span></td><td> </td>';
+                            '</span></div>';
             if ($othercontrol{$server}) {
                 $dom_in_effect = $othercontrol{$server};
                 my ($current,$forsaml);
@@ -8427,7 +8807,7 @@
                         $forsaml = 1;
                     }
                 }
-                $aliasrows .= '<td class="LC_left_item" style="vertical-align: baseline;">'.
+                $aliasrows .= '<div class="LC_grid_cell" role="gridcell" style="text-align: left; vertical-align: baseline;">'.
                               &mt('Alias').':&nbsp';
                 if ($current) {
                     $aliasrows .= $current;
@@ -8439,7 +8819,7 @@
                 }
                 $aliasrows .= ' <span class="LC_small">('.
                               &mt('controlled by domain: [_1]',
-                                  '<b>'.$dom_in_effect.'</b>').')</span></td>';
+                                  '<b>'.$dom_in_effect.'</b>').')</span></div>';
             } else {
                 $dom_in_effect = $dom;
                 my ($current,$samlon,$samloff);
@@ -8455,42 +8835,47 @@
                         undef($samloff);
                     }
                 }
-                $aliasrows .= '<td class="LC_left_item" style="vertical-align: baseline;">'.
-                              &mt('Alias').': '.
+                $aliasrows .= '<div class="LC_grid_cell" role="gridcell" style="text-align: left; vertical-align: baseline; line-height: 200%;">'.
+                              '<label>'.&mt('Alias').': '.
                               '<input type="text" name="wafproxy_alias_'.$server.'" '.
-                              'value="'.$current.'" size="30" />'.
-                              (' 'x2).'<span class="LC_nobreak">'.
-                              &mt('Alias used for SSO Auth').': <label>'.
+                              'value="'.$current.'" size="30" /></label>'.
+                              (' 'x2).
+                              '<fieldset class="LC_borderless">'.
+                              '<legend class="LC_visually_hidden">'.&mt('Alias used for SSO Auth for hostname: [_1]',$server).'</legend>'.
+                              '<span class="LC_nobreak">'.
+                              '<span aria-hidden="true">'.&mt('Alias used for SSO Auth').': </span><label>'.
                               '<input type="radio" value="0"'.$samloff.' name="wafproxy_alias_saml_'.$server.'" />'.
                               &mt('No').'</label> <label>'.
                               '<input type="radio" value="1"'.$samlon.' name="wafproxy_alias_saml_'.$server.'" />'.
-                              &mt('Yes').'</label></span>'.
-                              '</td>';
+                              &mt('Yes').'</label></span></fieldset>'.
+                              '</div>';
             }
-            $aliasrows .= '</tr>';
+            $aliasrows .= '</div>';
             $aliasinfo{$dom_in_effect} .= $aliasrows;
         }
         if ($aliasinfo{$dom}) {
             my ($onclick,$wafon,$wafoff,$showtable);
             $onclick = ' onclick="javascript:toggleWAF();"';
             $wafoff = ' checked="checked"';
-            $showtable = ' style="display:none";';
+            $showtable = ' style="display: none;"';
             if ($showdom) {
                 $wafon = $wafoff;
                 $wafoff = '';
-                $showtable = ' style="display:inline;"';
+                $showtable = ' style="display: inline;"';
             }
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             $datatable = '<tr'.$css_class.'>'.
                          '<td class="LC_left_item">'.&mt('Domain: [_1]','<b>'.$dom.'</b>').'<br />'.
+                         '<fieldset class="LC_borderless">'.
+                         '<legend class="LC_visually_hidden">'.&mt('WAF in use for domain: [_1]',$dom).'</legend>'.
                          '<span class="LC_nobreak">'.&mt('WAF in use?').' <label>'.
                          '<input type="radio" name="wafproxy_'.$dom.'" value="1"'.$wafon.$onclick.' />'.
                          &mt('Yes').'</label>'.(' 'x2).'<label>'.
                          '<input type="radio" name="wafproxy_'.$dom.'" value="0"'.$wafoff.$onclick.' />'.
-                         &mt('No').'</label></span></td>'.
+                         &mt('No').'</label></span></fieldset></td>'.
                          '<td class="LC_left_item">'.
-                         '<table id="wafproxy_table"'.$showtable.'>'.$aliasinfo{$dom}.
-                         '</table></td></tr>';
+                         '<div class="LC_grid" role="grid" id="wafproxy_table"'.$showtable.'>'.$aliasinfo{$dom}.
+                         '</div></td></tr>';
             $itemcount++;
         }
         if (keys(%otherdoms)) {
@@ -8510,22 +8895,22 @@
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             my ($nowafstyle,$wafstyle,$curr_remotip,$currwafdisplay,$vpndircheck,$vpnaliascheck,
                 $currwafvpn,$wafrangestyle,$alltossl,$ssltossl);
-            $wafstyle = ' style="display:none;"';
+            $wafstyle = ' style="display: none;"';
             $nowafstyle = ' style="display:table-row;"';
-            $currwafdisplay = ' style="display: none"';
-            $wafrangestyle = ' style="display: none"';
+            $currwafdisplay = ' style="display: none;"';
+            $wafrangestyle = ' style="display: none;"';
             $curr_remotip = 'n';
             $ssltossl = ' checked="checked"';
             if ($showdom) {
-                $wafstyle = ' style="display:table-row;"';
-                $nowafstyle =  ' style="display:none;"';
+                $wafstyle = ' style="display: table-row;"';
+                $nowafstyle =  ' style="display: none;"';
                 if (keys(%{$values{$dom}})) {
                     if ($values{$dom}{remoteip} =~ /^[nmh]$/) {
                         $curr_remotip = $values{$dom}{remoteip};
                     }
                     if ($curr_remotip eq 'h') {
-                        $currwafdisplay = ' style="display:table-row"';
-                        $wafrangestyle = ' style="display:inline-block;"';
+                        $currwafdisplay = ' style="display: table-row;"';
+                        $wafrangestyle = ' style="display: inline-block;"';
                     }
                     if ($values{$dom}{'sslopt'}) {
                         $alltossl = ' checked="checked"';
@@ -8535,10 +8920,10 @@
                 if (($values{$dom}{'vpnint'} ne '') || ($values{$dom}{'vpnext'} ne '')) {
                     $vpndircheck = ' checked="checked"';
                     $currwafvpn = ' style="display:table-row;"';
-                    $wafrangestyle = ' style="display:inline-block;"';
+                    $wafrangestyle = ' style="display: inline-block;"';
                 } else {
                     $vpnaliascheck = ' checked="checked"';
-                    $currwafvpn = ' style="display:none;"';
+                    $currwafvpn = ' style="display: none;"';
                 }
             }
             $datatable .= '<tr'.$css_class.' id="nowafproxyrow_'.$dom.'"'.$wafstyle.'>'.
@@ -8550,9 +8935,11 @@
                           '<div id="wafproxyranges_'.$dom.'">'.&mt('Format for comma separated IP ranges').':<br />'.
                           &mt('A.B.C.D/N or A.B.C.D-E.F.G.H').'<br />'.
                           &mt('Range(s) stored in CIDR notation').'</div></td>'.
-                          '<td class="LC_left_item"><table>'.
-                          '<tr>'.
-                          '<td valign="top">'.$lt{'remoteip'}.': '.
+                          '<td class="LC_left_item">'.
+                          '<div class="LC_grid" role="grid">'.
+                          '<div class="LC_grid_row" role="row">'.
+                          '<div class="LC_grid_cell" role="gridcell">'.
+                          '<label for="wafproxy_remoteip">'.$lt{'remoteip'}.'</label>: '.
                           '<select name="wafproxy_remoteip" id="wafproxy_remoteip" onchange="javascript:updateWAF();">';
             foreach my $option ('m','h','n') {
                 my $sel;
@@ -8562,39 +8949,51 @@
                 $datatable .= '<option value="'.$option.'"'.$sel.'>'.
                               $ip_methods{$option}.'</option>';
             }
-            $datatable .= '</select></td></tr>'."\n".
-                          '<tr id="wafproxy_header"'.$currwafdisplay.'><td>'.
-                          $lt{'ipheader'}.': '.
+            $datatable .= '</select></div></div>'."\n".
+                          '<div id="wafproxy_header" class="LC_grid_row" role="row"'.$currwafdisplay.'>'. 
+                          '<div class="LC_grid_cell" role="gridcell">'.
+                          '<label>'.$lt{'ipheader'}.': '.
                           '<input type="text" value="'.$values{$dom}{'ipheader'}.'" '.
-                          'name="wafproxy_ipheader" />'.
-                          '</td></tr>'."\n".
-                          '<tr id="wafproxy_trust"'.$currwafdisplay.'><td>'.
-                          $lt{'trusted'}.':<br />'.
+                          'name="wafproxy_ipheader" /></label>'.
+                          '</div></div>'."\n".
+                          '<div id="wafproxy_trust" class="LC_grid_row" role="row"'.$currwafdisplay.'>'. 
+                          '<div class="LC_grid_cell" role="gridcell">'.
+                          '<label>'.$lt{'trusted'}.':<br />'.
                           '<textarea name="wafproxy_trusted" rows="3" cols="80">'.
-                          $values{$dom}{'trusted'}.'</textarea>'.
-                          '</td></tr>'."\n".
-                          '<tr><td><hr /></td></tr>'."\n".
-                          '<tr>'.
-                          '<td valign="top">'.$lt{'vpnaccess'}.':<br /><span class="LC_nobreak">'.
+                          $values{$dom}{'trusted'}.'</textarea></label>'.
+                          '</div></div>'."\n".
+                          '<div class="LC_grid_row" role="row">'.
+                          '<div class="LC_grid_cell" role="gridcell">'.
+                          '<hr /></div></div>'."\n".
+                          '<div class="LC_grid_row" role="row">'.
+                          '<div class="LC_grid_cell" role="gridcell">'.$lt{'vpnaccess'}.':<br />'.
+                          '<fieldset class="LC_borderless">'.
+                          '<legend class="LC_visually_hidden">'.$lt{'vpnaccess'}.'</legend>'.
+                          '<span class="LC_nobreak">'.
                           '<label><input type="radio" name="wafproxy_vpnaccess"'.$vpndircheck.' value="1" onclick="javascript:checkWAF();" />'.
                           $lt{'vpndirect'}.'</label>'.(' 'x2).
                           '<label><input type="radio" name="wafproxy_vpnaccess"'.$vpnaliascheck.' value="0" onclick="javascript:checkWAF();" />'.
-                          $lt{'vpnaliased'}.'</label></span></td></tr>';
+                          $lt{'vpnaliased'}.'</label></span></fieldset></div></div>';
             foreach my $item ('vpnint','vpnext') {
-                $datatable .= '<tr id="wafproxy_show_'.$item.'"'.$currwafvpn.'>'.
-                              '<td valign="top">'.$lt{$item}.':<br />'.
+                $datatable .= '<div id="wafproxy_show_'.$item.'" class="LC_grid_row" role="row"'.$currwafvpn.'>'.
+                              '<div class="LC_grid_cell" role="gridcell"><label>'.$lt{$item}.':<br />'.
                               '<textarea name="wafproxy_'.$item.'" rows="3" cols="80">'.
-                              $values{$dom}{$item}.'</textarea>'.
-                              '</td></tr>'."\n";
+                              $values{$dom}{$item}.'</textarea></label>'.
+                              '</div></div>'."\n";
             }
-            $datatable .= '<tr><td><hr /></td></tr>'."\n".
-                          '<tr>'.
-                          '<td valign="top">'.$lt{'sslopt'}.':<br /><span class="LC_nobreak">'.
+            $datatable.=  '<div class="LC_grid_row" role="row">'.
+                          '<div class="LC_grid_cell" role="gridcell">'.
+                          '<hr /></div></div>'."\n".
+                          '<div class="LC_grid_row" role="row">'.
+                          '<div class="LC_grid_cell" role="gridcell">'.$lt{'sslopt'}.':<br />'.
+                          '<fieldset class="LC_borderless">'.
+                          '<legend class="LC_visually_hidden">'.$lt{'sslopt'}.'</legend>'.
+                          '<span class="LC_nobreak">'.
                           '<label><input type="radio" name="wafproxy_sslopt"'.$alltossl.' value="1" />'.
                           $lt{'alltossl'}.'</label>'.(' 'x2).
                           '<label><input type="radio" name="wafproxy_sslopt"'.$ssltossl.' value="0" />'.
-                          $lt{'ssltossl'}.'</label></span></td></tr>'."\n".
-                          '</table></td></tr>';
+                          $lt{'ssltossl'}.'</label></span></fieldset></div></div>'."\n".
+                          '</div></td></tr>';
         }
         if (keys(%otherdoms)) {
             foreach my $domain (sort(keys(%otherdoms))) {
@@ -8735,13 +9134,15 @@
             next if ($type ne 'version' && !@locations);
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             $datatable .= '<tr'.$css_class.'>
-                           <td><span class="LC_nobreak">'.$titles->{$type}.'</span><br />
+                           <td><span class="LC_nobreak" aria-hidden="true">'.$titles->{$type}.'</span><br />
+                           <fieldset class="LC_borderless">
+                           <legend class="LC_visually_hidden">'.$titles->{$type}.'</legend>
                            <span class="LC_nobreak"> 
                            <label><input type="radio" name="'.$prefix.'_'.$type.'_inuse" '.$checkedoff{$type}.' value="0" />'.&mt('Not in use').'</label> 
-                           <label><input type="radio" name="'.$prefix.'_'.$type.'_inuse" '.$checkedon{$type}.' value="1" />'.&mt('In use').'</label></span></td><td>';
+                           <label><input type="radio" name="'.$prefix.'_'.$type.'_inuse" '.$checkedon{$type}.' value="1" />'.&mt('In use').'</label></span></fieldset></td><td>';
             if ($type eq 'version') {
                 my @lcversions = &Apache::lonnet::all_loncaparevs();
-                my $selector = '<select name="'.$prefix.'_version">';
+                my $selector = '<select name="'.$prefix.'_version" aria-label="'.&mt('Set version requirement').'">';
                 foreach my $version (@lcversions) {
                     my $selected = '';
                     if ($current{'version'} eq $version) {
@@ -8753,13 +9154,15 @@
                 $selector .= '</select> ';
                 $datatable .= &mt('remote server must be version: [_1] or later',$selector);
             } else {
-                $datatable.= '<div><input type="button" value="'.&mt('check all').'" '.
+                $datatable.= '<fieldset>'.
+                             '<legend><input type="button" value="'.&mt('check all').'" '.
                              'onclick="javascript:checkAll(document.display.'.$prefix.'_'.$type.')"'.
                              ' />'.(' 'x2).
                              '<input type="button" value="'.&mt('uncheck all').'" '.
                              'onclick="javascript:uncheckAll(document.display.'.$prefix.'_'.$type.')" />'.
                              "\n".
-                             '</div><div><table>';
+                             '</legend>'."\n".
+                             '<div class="LC_grid" role="grid">';
                 my $rem;
                 for (my $i=0; $i<@locations; $i++) {
                     my ($showloc,$value,$checkedtype);
@@ -8781,25 +9184,17 @@
                     $rem = $i%($numinrow);
                     if ($rem == 0) {
                         if ($i > 0) {
-                            $datatable .= '</tr>';
+                            $datatable .= '</div>';
                         }
-                        $datatable .= '<tr>';
+                        $datatable .= '<div class="LC_grid_row" role="row">';
                     }
-                    $datatable .= '<td class="LC_left_item">'.
+                    $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
                                   '<span class="LC_nobreak"><label>'.
                                   '<input type="checkbox" name="'.$prefix.'_'.$type.
                                   '" value="'.$value.'"'.$checkedtype.' />'.$showloc.
-                                  '</label></span></td>';
+                                  '</label></span></div>';
                 }
-                $rem = @locations%($numinrow);
-                my $colsleft = $numinrow - $rem;
-                if ($colsleft > 1 ) {
-                    $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'.
-                                  ' </td>';
-                } elsif ($colsleft == 1) {
-                    $datatable .= '<td class="LC_left_item"> </td>';
-                }
-                $datatable .= '</tr></table>';
+                $datatable .= '</div></div></fieldset>';
             }
             $datatable .= '</td></tr>';
             $itemcount ++;
@@ -8837,6 +9232,10 @@
     } else {
         my %titles = &ssl_titles();
         my (%by_ip,%by_location, at intdoms, at instdoms);
+        @intdoms = ();
+        @instdoms = ();
+        %by_ip = ();
+        %by_location = ();
         &build_location_hashes(\@intdoms,\%by_ip,\%by_location,\@instdoms);
         my @alldoms = &Apache::lonnet::all_domains();
         my %serverhomes = %Apache::lonnet::serverhomeIDs;
@@ -8894,6 +9293,8 @@
                 }
                 unless ($skip) {
                     $checked{'yes'} = ' checked="checked"'; 
+                    $datatable .= '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                                  '<legend class="LC_visually_hidden">'.$titles{$type}.'</legend>';  
                     if (ref($settings) eq 'HASH') {
                         if (ref($settings->{$position}) eq 'HASH') {
                             if ($settings->{$position}->{$type} =~ /^(no|req)$/) {
@@ -8913,6 +9314,7 @@
                                       'value="'.$option.'"'.$checked{$option}.' />'.$titles{$option}.
                                       '</label></span>'.(' 'x2);
                     }
+                    $datatable .= '</fieldset>';
                 }
                 $datatable .= '</td></tr>';
                 $itemcount ++; 
@@ -9007,7 +9409,7 @@
                 if ($location) {
                     if (grep(/^\Q$location\E$/,@{$intdoms})) {
                         my $dom = &Apache::lonnet::host_domain($id);
-                        unless (grep(/^\Q$dom\E/,@{$instdoms})) {
+                        unless (grep(/^\Q$dom\E$/,@{$instdoms})) {
                             push(@{$instdoms},$dom);
                         }
                         next;
@@ -9154,9 +9556,11 @@
             $css_class = $itemcount%2 ? ' class="LC_odd_row"' : '';
             $datatable .= '<tr'.$css_class.'>
                            <td rowspan="2">
-                            <span class="LC_nobreak">'.
+                           <span class="LC_nobreak">'.
                           &mt('[_1] when busy, offloads to:'
-                              ,'<b>'.$server.'</b>').'</span><br />'.
+                              ,'<b>'.$server.'</b>').'</span>'.
+                          '<fieldset class="LC_borderless" style="display: block; line-height: 185%;">'.
+                          '<legend class="LC_visually_hidden">'.&mt('users offloaded if busy?').'</legend>'.
                           '<span class="LC_nobreak">'."\n".
                           '<label><input type="checkbox" name="offloadnow" value="'.$server.'"'.$checkednow.' />'.
                           ' '.&mt('Switch any active user on next access').'</label></span>'.
@@ -9168,6 +9572,7 @@
                           ' '.&mt('Switch other institutions on next access').'</label></span>'.
                           "\n";
             }
+            $datatable .= '</fieldset></td>';
             my (%current,%canselect);
             my @choices = 
                 &possible_newspares($server,$spareid->{$server},$serverhomes,$altids);
@@ -9179,43 +9584,36 @@
                             if ($othercontrol) {
                                 $current{$type} = join(', ', at spares);
                             } else {
-                                $current{$type} .= '<table>';
+                                $current{$type} .= '<div class="LC_grid" role="grid" style="margin: 0 2px 0 2px;">';
                                 my $numspares = scalar(@spares);
                                 for (my $i=0;  $i<@spares; $i++) {
                                     my $rem = $i%($numinrow);
                                     if ($rem == 0) {
                                         if ($i > 0) {
-                                            $current{$type} .= '</tr>';
+                                            $current{$type} .= '</div>';
                                         }
-                                        $current{$type} .= '<tr>';
+                                        $current{$type} .= '<div class="LC_grid_row" role="row">';
                                     }
-                                    $current{$type} .= '<td><label><input type="checkbox" name="spare_'.$type.'_'.$server.'" id="spare_'.$type.'_'.$server.'_'.$i.'" checked="checked" value="'.$spareid->{$server}{$type}[$i].'" onclick="updateNewSpares(this.form,'."'$server'".');" /> '.
+                                    $current{$type} .= '<div class="LC_grid_cell" role="gridcell">'.
+                                                       '<label><input type="checkbox" name="spare_'.$type.'_'.$server.'" id="spare_'.$type.'_'.$server.'_'.$i.'" checked="checked" value="'.$spareid->{$server}{$type}[$i].'" onclick="updateNewSpares(this.form,'."'$server'".');" /> '.
                                                        $spareid->{$server}{$type}[$i].
-                                                       '</label></td>'."\n";
-                                }
-                                my $rem = @spares%($numinrow);
-                                my $colsleft = $numinrow - $rem;
-                                if ($colsleft > 1 ) {
-                                    $current{$type} .= '<td colspan="'.$colsleft.
-                                                       '" class="LC_left_item">'.
-                                                       ' </td>';
-                                } elsif ($colsleft == 1) {
-                                    $current{$type} .= '<td class="LC_left_item"> </td>'."\n";
+                                                       '</label></div>'."\n";
                                 }
-                                $current{$type} .= '</tr></table>';
+                                $current{$type} .= '</div></div>';
                             }
                         }
                     }
                     if ($current{$type} eq '') {
-                        $current{$type} = &mt('None specified');
+                        $current{$type} = ' '.&mt('None specified');
                     }
                     if ($othercontrol) {
                         if ($type eq 'primary') {
                             $canselect{$type} = $othercontrol;
                         }
                     } else {
-                        $canselect{$type} = 
-                            &mt('Add new [_1]'.$type.'[_2]:','<i>','</i>').' '.
+                        $canselect{$type} =
+                            '<label for="newspare_'.$type.'_'.$server.'">'.
+                            &mt('Add new [_1]'.$type.'[_2]:','<i>','</i>').'</label> '.
                             '<select name="newspare_'.$type.'_'.$server.'" '.
                             'id="newspare_'.$type.'_'.$server.'" onchange="checkNewSpares('."'$server','$type'".');">'."\n".
                             '<option value="" selected ="selected">'.&mt('Select').'</option>'."\n";
@@ -9593,7 +9991,7 @@
     }
     my $space;
     if ($islast && $num == 1) {
-        $space = '<div style="display:inline-block;"> </div>';
+        $space = '<div style="display: inline-block;"> </div>';
     }
     my $output =
         '<tr class="'.$css_class.'" id="balanceruletr_'.$balnum.'_'.$num.'"><td style="vertical-align: top">'.$space.
@@ -9840,7 +10238,9 @@
             }
             $datatable .= '<tr'.$css_class.'>'.
                          '<td><span class="LC_nobreak">'.$lt{$item}.
-                         '</span></td><td style="text-align: right">';
+                         '</span></td><td style="text-align: right">'.
+                         '<fieldset class="LC_borderless" style="line-height: 175%;">'.
+                         '<legend class="LC_visually_hidden">'.$lt{$item}.'</legend>';
             my @options = ('any');
             if (ref($rules) eq 'HASH') {
                 if (keys(%{$rules}) > 0) {
@@ -9859,7 +10259,7 @@
                               $item.'" value="'.$option.'"'.$check.'/> '.
                               $lt{$option}.'</label>  </span>';
             }
-            $datatable .= '</td></tr>';
+            $datatable .= '</fieldset></td></tr>';
         }
     } else {
         my @contexts = ('author','course','domain');
@@ -9897,6 +10297,8 @@
             $datatable .=   '<tr'.$css_class.'>'.
                             '<td>'.$title{$item}.
                             '</td><td class="LC_left_item">'.
+                            '<fieldset class="LC_borderless" style="line-height: 175%;">'.
+                            '<legend class="LC_visually_hidden">'.$title{$item}.'</legend>'.
                             '<span class="LC_nobreak">';
             foreach my $auth (@authtypes) {
                 $datatable .= '<label>'. 
@@ -9904,7 +10306,7 @@
                               $checked{$item}{$auth}.' value="'.$auth.'" />'.
                               $authname{$auth}.'</label> ';
             }
-            $datatable .= '</span></td></tr>';
+            $datatable .= '</span></fieldset></td></tr>';
             $rownum ++;
         }
         $$rowtotal += $rownum;
@@ -9977,17 +10379,20 @@
         my $rem;
         my $numperrow = 2;
         my $css_class = $$rowtotal%2?' class="LC_odd_row"':'';
+        my $title = &mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)');
         $datatable .= '<tr'.$css_class.'>'.
-                     '<td class="LC_left_item">'.&mt('Mapping of Shibboleth environment variable names to user data fields (SSO auth)').'</td>'.
+                     '<td class="LC_left_item">'.$title.'</td>'.
                      '<td class="LC_left_item">'."\n".
-                     '<table>'."\n";
+                     '<fieldset class="LC_borderless">'.
+                     '<legend class="LC_visually_hidden">'.$title.'</legend>'.
+                     '<div class="LC_grid" role="grid">'."\n";
         for (my $i=0; $i<@fields; $i++) {
             $rem = $i%($numperrow);
             if ($rem == 0) {
                 if ($i > 0) {
-                    $datatable .= '</tr>';
+                    $datatable .= '</div>';
                 }
-                $datatable .= '<tr>';
+                $datatable .= '<div class="LC_grid_row" role="row">';
             }
             my $currval;
             if (ref($createsettings) eq 'HASH') {
@@ -9995,20 +10400,13 @@
                     $currval = $createsettings->{'shibenv'}{$fields[$i]};
                 }
             }
-            $datatable .= '<td class="LC_left_item">'.
-                          '<span class="LC_nobreak">'.
+            $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
+                          '<span class="LC_nobreak"><label>'.
                           '<input type="text" name="shibenv_'.$fields[$i].'" '.
                           'value="'.$currval.'" size="10" /> '.
-                          $fieldtitles{$fields[$i]}.'</span></td>';
+                          $fieldtitles{$fields[$i]}.'</label></span></div>';
         }
-        my $colsleft = $numperrow - $rem;
-        if ($colsleft > 1 ) {
-            $datatable .= '<td colspan="'.$colsleft.'" class="LC_left_item">'.
-                         ' </td>';
-        } elsif ($colsleft == 1) {
-            $datatable .= '<td class="LC_left_item"> </td>';
-        }
-        $datatable .= '</tr></table></td></tr>';
+        $datatable .= '</div></div></fieldset></td></tr>';
         $$rowtotal ++;
     } elsif ($position eq 'middle') {
         my %domconf = &Apache::lonnet::get_dom('configuration',['usermodification'],$dom);
@@ -10041,7 +10439,7 @@
         my $classprefix = 'LC_canmodify_emailusername_';
         my $optionsprefix = 'LC_options_emailusername_';
         my $display = 'none';
-        my $rowstyle = 'display:none';
+        my $rowstyle = 'display: none;';
         if (grep(/^\Qemail\E$/, at selfcreate)) {
             $display = 'block';
             $rowstyle = 'display:table-row';
@@ -10096,7 +10494,7 @@
                 $css_class .= $customclass;
                 my $rowid = $optionsprefix.$status;
                 my $hidden = 1;
-                my $currstyle = 'display:none';
+                my $currstyle = 'display: none;';
                 if (grep(/^\Q$status\E$/, at ordered)) {
                     $currstyle = $rowstyle;
                     $hidden = 0;
@@ -10125,14 +10523,14 @@
         if (@posstypes) {
             foreach my $status (@posstypes) {
                 my $rowid = $classprefix.$status;
-                my $datarowstyle = 'display:none';
+                my $datarowstyle = 'display: none;';
                 if (grep(/^\Q$status\E$/, at ordered)) {
                     $datarowstyle = $rowstyle;
                 }
                 $datatable .= &modifiable_userdata_row('cancreate','emailusername_'.$status,$settings,
                                                        $numinrow,$$rowtotal,\%usertypeshash,$infofields,
                                                        $infotitles,$rowid,$customclass,$datarowstyle);
-                unless ($datarowstyle eq 'display:none') {
+                unless ($datarowstyle eq 'display: none;') {
                     $$rowtotal ++;
                 }
             }
@@ -10263,7 +10661,7 @@
     if ($rowstyle) {
         $rowstyle = ' style="'.$rowstyle.'"';
     }
-    my ($output,$description);
+    my ($output,$description,$showcustom,$customchecked);
     if ($type eq 'default') {
         $description = &mt('Requests for: [_1]',$typetitle);
     } else {
@@ -10302,7 +10700,6 @@
                                                      custom  => 'Custom restrictions',
                                                    );
             @options = ('any','inst','noninst');
-            my $showcustom;
             if (ref($emailrules) eq 'HASH') {
                 if (keys(%{$emailrules}) > 0) {
                     push(@options,'custom');
@@ -10342,6 +10739,9 @@
             $defoption = 'all';
             $name = 'cancreate_usernameoptions_'.$type;
         }
+        $output .= '<fieldset class="LC_borderless" style="line-height: 185%;">'.
+                   '<legend class="LC_visually_hidden">'.
+                   &mt('Options for [_1]',$headers{$item}.' -- '.$description).'</legend>';
         foreach my $option (@options) {
             my $checked;
             if (ref($hashref) eq 'HASH') {
@@ -10369,6 +10769,7 @@
             } elsif (($item eq 'email') && ($hascustom)) {
                 if ($option eq 'custom') {
                     $checked = ' checked="checked"';
+                    $customchecked = $checked;
                 }
             } elsif ($option eq $defoption) {
                 $checked = ' checked="checked"';
@@ -10378,19 +10779,7 @@
                        $checked.' value="'.$option.'"'.$onclick.' />'.
                        $choices{$option}.'</label></span><br />';
             if ($item eq 'email') {
-                if ($option eq 'custom') {
-                    my $id = 'cancreate_emailrule_'.$type;
-                    my $display = 'none';
-                    if ($checked) {
-                        $display = 'inline';
-                    }
-                    my $numinrow = 2;
-                    $output .= '<fieldset id="'.$id.'" style="display:'.$display.';">'.
-                               '<legend>'.&mt('Disallow').'</legend><table>'.
-                               &user_formats_row('email',$settings,$emailrules,
-                                                 $emailruleorder,$numinrow,'',$type);
-                              '</table></fieldset>';
-                } elsif (($option eq 'inst') || ($option eq 'noninst')) {
+                if (($option eq 'inst') || ($option eq 'noninst')) {
                     my %text = &Apache::lonlocal::texthash (
                                                              inst    => 'must end:',
                                                              noninst => 'cannot end:',
@@ -10410,12 +10799,28 @@
                         $display = 'inline';
                     }
                     $output .= '<div id="'.$condition.'" style="display:'.$display.';">'.
-                               '<span class="LC_domprefs_email">'.$text{$option}.'</span> '.
-                               '<input type="text" name="'.$condition.'" value="'.$value.'" size="10" />'.
+                               '<span class="LC_domprefs_email"><label for="'.$condition.'_text">'.
+                               $text{$option}.'</label></span> '.
+                               '<input type="text" name="'.$condition.'" id="'.$condition.'_text" value="'.$value.'" size="10" />'.
                                '</div>';
                 }
             }
         }
+        $output .= '</fieldset>';      
+        if (($item eq 'email') && ($showcustom)) {
+           my $id = 'cancreate_emailrule_'.$type;
+           my $display = 'none';
+           if ($customchecked) {
+               $display = 'inline';
+           }
+           my $numinrow = 2;
+           $output .= '<fieldset id="'.$id.'" style="display:'.$display.';">'.
+                      '<legend>'.&mt('Disallow').'</legend>'.
+                      '<div class="LC_grid" role="grid">'.
+                      &user_formats_row('email',$settings,$emailrules,
+                                        $emailruleorder,$numinrow,'',$type).
+                      '</div></fieldset>';
+        }
         $output .= '</td>'."\n";
     }
     $output .= "</tr></table></td></tr>\n";
@@ -10490,7 +10895,10 @@
     }
     my $output = '<tr'.$css_class.'>'.
                  '<td class="LC_left_item">'.$rowname.'</td><td class="LC_left_item" colspan="'.$colspan.'">'."\n".
-                 '<table><tr><td><fieldset class="LC_captcha"><legend>'.$lt{'captcha'}.'</legend>'."\n";
+                 '<div class="LC_grid" role="grid">'.
+                 '<div class="LC_grid_row" role="row">'.
+                 '<div class="LC_grid_cell" role="gridcell">'."\n".
+                 '<fieldset class="LC_captcha"><legend>'.$lt{'captcha'}.'</legend>'."\n";
     foreach my $option ('original','successor','notused') {
         $output .= '<span class="LC_nobreak"><label><input type="radio" name="'.$context.'_captcha" value="'.
                    $option.'" '.$checked{$option}.' onchange="javascript:updateCaptcha('."'captcha','$context',this.form".');" />'.
@@ -10511,8 +10919,9 @@
 # new site at https://dashboard.hcaptcha.com/, and if Turnstile is to be used a site key and secret key
 # will need to be created by visiting https://dash.cloudflare.com and adding a new Turnstile widget.
 #
-    $output .= '</fieldset></td></tr>'."\n".
-               '<tr><td class="LC_zero_height">'."\n".
+    $output .= '</fieldset></div></div>'."\n".
+               '<div class="LC_grid_row" role="row">'.
+               '<div class="LC_grid_cell" role="gridcell" style="line-height: 0;">'."\n".
                '<fieldset class="LC_captcha" id="'.$context.'_recaptchatype" style="display:'.$dispprov.'">'.
                '<legend>'.$lt{'type'}.'</legend>'."\n";
     foreach my $type ('recaptcha','hcaptcha','turnstile') {
@@ -10538,14 +10947,15 @@
                ' <input id="'.$context.'_recaptchathresh" type="'.$threshentry.'" size="3"'.
                ' name="'.$context.'_captchathreshold" value="'.$threshold.'" /></span></span>'."\n".
                '</fieldset><br />'.
-               '<fieldset class="LC_captcha" id="'.$context.'_recaptchakeys" style="display:'.$dispkeys.'"><legend>'.$lt{'keys'}.'</legend>'."\n".
-               '<span class="LC_nobreak">'.$lt{'pub'}.': '.
+               '<fieldset class="LC_captcha" id="'.$context.'_recaptchakeys" style="display:'.$dispkeys.'; line-height: 180%;"><legend>'.$lt{'keys'}.'</legend>'."\n".
+               '<span class="LC_nobreak"><label>'.$lt{'pub'}.': '.
                '<input type="text" name="'.$context.'_recaptchapub" value="'.$currpub.'" size="40" />'.
-               '</span><br />'."\n".
-               '<span class="LC_nobreak">'.$lt{'priv'}.': '.
-               '<input type="text" name="'.$context.'_recaptchapriv" value="'.$currpriv.'" size="40" /></span>'."\n".
+               '</label></span><br />'."\n".
+               '<span class="LC_nobreak"><label>'.$lt{'priv'}.': '.
+               '<input type="text" name="'.$context.'_recaptchapriv" value="'.$currpriv.'" size="40" />'.
+               '</label></span>'."\n".
                '</fieldset><br />'."\n".
-               '</td></tr></table>'."\n".
+               '</div></div></div>'."\n".
                '</td></tr>';
     return $output;
 }
@@ -10562,7 +10972,8 @@
         $output = '<tr '.$css_class.'>'.
                   '<td><span class="LC_nobreak">'.
                   &mt("Format rules to check for $text{$type}: ").
-                  '</td><td class="LC_left_item" colspan="2"><table>';
+                  '</td><td class="LC_left_item" colspan="2">'.
+                  '<div class="LC_grid" role="grid">';
     }
     my $rem;
     if (ref($ruleorder) eq 'ARRAY') {
@@ -10571,9 +10982,9 @@
                 my $rem = $i%($numinrow);
                 if ($rem == 0) {
                     if ($i > 0) {
-                        $output .= '</tr>';
+                        $output .= '</div>';
                     }
-                    $output .= '<tr>';
+                    $output .= '<div class="LC_grid_row" role="row">';
                 }
                 my $check = ' ';
                 if (ref($settings) eq 'HASH') {
@@ -10593,28 +11004,18 @@
                 if ($type eq 'email') {
                     $name .= '_'.$status;
                 }
-                $output .= '<td class="LC_left_item">'.
+                $output .= '<div class="LC_grid_cell" role="gridcell">'.
                            '<span class="LC_nobreak"><label>'.
                            '<input type="checkbox" name="'.$name.'" '.
                            'value="'.$ruleorder->[$i].'"'.$check.'/>'.
-                           $rules->{$ruleorder->[$i]}{'name'}.'</label></span></td>';
+                           $rules->{$ruleorder->[$i]}{'name'}.'</label></span></div>';
             }
         }
         $rem = @{$ruleorder}%($numinrow);
     }
-    my $colsleft;
-    if ($rem) {
-        $colsleft = $numinrow - $rem;
-    }
-    if ($colsleft > 1 ) {
-        $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'.
-                   ' </td>';
-    } elsif ($colsleft == 1) {
-        $output .= '<td class="LC_left_item"> </td>';
-    }
-    $output .= '</tr>';
+    $output .= '</div>';
     unless (($type eq 'email') || ($type eq 'unamemap')) {
-        $output .= '</table></td></tr>';
+        $output .= '</div></td></tr>';
     }
     return $output;
 }
@@ -10725,9 +11126,17 @@
                 $css_class = ' class="LC_odd_row" ';
             }
             $datatable .= '<tr'.$css_class.'>'.
-                          '<td><span class="LC_nobreak">'.$titles->{$item}.
-                          '</span></td><td class="LC_right_item" colspan="3">';
+                          '<td><span class="LC_nobreak">';
+            if (($item eq 'auth_arg_def') || ($item eq 'portal_def') ||
+                ($item eq 'datelocale_def') || ($item eq 'lang_def')) {
+                $datatable .= '<label for="'.$item.'">'.$titles->{$item}.'</label>';
+            } else {
+                $datatable .= $titles->{$item};
+            }
+            $datatable .= '</span></td><td class="LC_right_item" colspan="3">';
             if ($item eq 'auth_def') {
+                $datatable .= '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                              '<legend class="LC_visually_hidden">'.$titles->{$item}.'</legend>';
                 my @authtypes = ('internal','krb4','krb5','localauth','lti');
                 my %shortauth = (
                                  internal => 'int',
@@ -10746,18 +11155,20 @@
                                   '" value="'.$auth.'"'.$checked.'/>'.
                                   $authnames{$shortauth{$auth}}.'</label>  ';
                 }
+                $datatable .= '</fieldset>';
             } elsif ($item eq 'timezone_def') {
                 my $includeempty = 1;
                 $datatable .= &Apache::loncommon::select_timezone($item,$defaults{$item},undef,$includeempty);
             } elsif ($item eq 'datelocale_def') {
                 my $includeempty = 1;
-                $datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty);
+                $datatable .= &Apache::loncommon::select_datelocale($item,$defaults{$item},undef,$includeempty,'',$item);
             } elsif ($item eq 'lang_def') {
                 my $includeempty = 1;
-                $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty);
+                $datatable .= &Apache::loncommon::select_language($item,$defaults{$item},$includeempty,'',$item);
             } elsif ($item eq 'portal_def') {
-                $datatable .= '<input type="text" name="'.$item.'" value="'.
-                              $defaults{$item}.'" size="25" onkeyup="portalExtras(this);" />';
+                $datatable .= '<div style="margin: 0 0 4px 0; padding: 0;">'.
+                              '<input type="text" name="'.$item.'" id="'.$item.'" value="'.
+                              $defaults{$item}.'" size="25" onkeyup="portalExtras(this);" /></div>';
                 my $portalsty = 'none';
                 if ($defaults{$item}) {
                     $portalsty = 'block';
@@ -10769,32 +11180,35 @@
                         $checkedon = $checkedoff;
                         $checkedoff = '';
                     }
-                    $datatable .= '<div id="'.$item.'_'.$field.'_div" style="display:'.$portalsty.'">'.
-                              '<span class="LC_nobreak">'.$titles->{$field}.' '.
+                    $datatable .= '<fieldset class="LC_borderless" id="'.$item.'_'.$field.'_div" style="display:'.$portalsty.'; line-height: 185%;">'.
+                              '<legend class="LC_visually_hidden">'.$titles->{$field}.'</legend>'.
+                              '<span class="LC_nobreak"><span aria-hidden="true">'.$titles->{$field}.' </span>'.
                               '<label><input type="radio" name="'.$item.'_'.$field.'" value="1"'.$checkedon.'/>'.&mt('Yes').'</label>'.
                               (' 'x2).
                               '<label><input type="radio" name="'.$item.'_'.$field.'" value="0"'.$checkedoff.'/>'.&mt('No').'</label>'.
-                              '</div>';
+                              '</span></fieldset>';
                 }
             } else {
-                $datatable .= '<input type="text" name="'.$item.'" value="'.$defaults{$item}.'" />';
+                $datatable .= '<input type="text" name="'.$item.'" id="'.$item.'" value="'.$defaults{$item}.'" />';
             }
             $datatable .= '</td></tr>';
             $rownum ++;
         }
     } elsif ($position eq 'middle') {
+	my $maxnum = 0;      
         my %defaults;
         if (ref($settings) eq 'HASH') {
             if ((ref($settings->{'inststatusorder'}) eq 'ARRAY') && (ref($settings->{'inststatustypes'}) eq 'HASH')) {
-                my $maxnum = @{$settings->{'inststatusorder'}};
+                $maxnum = @{$settings->{'inststatusorder'}};
                 for (my $i=0; $i<$maxnum; $i++) {
                     $css_class = $rownum%2?' class="LC_odd_row"':'';
                     my $item = $settings->{'inststatusorder'}->[$i];
                     my $title = $settings->{'inststatustypes'}->{$item};
+                    my $arialabel = &mt('List order for institutional user type: [_1]',$title);
                     my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'$item'".');"';
                     $datatable .= '<tr'.$css_class.'>'.
                                   '<td><span class="LC_nobreak">'.
-                                  '<select name="inststatus_pos_'.$item.'"'.$chgstr.'>';
+                                  '<select name="inststatus_pos_'.$item.'"'.$chgstr.' aria-label="'.$arialabel.'">';
                     for (my $k=0; $k<=$maxnum; $k++) {
                         my $vpos = $k+1;
                         my $selstr;
@@ -10804,44 +11218,48 @@
                         $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
                     }
                     $datatable .= '</select> '.&mt('Internal ID:').' <b>'.$item.'</b> '.
-                                  '<input type="checkbox" name="inststatus_delete" value="'.$item.'" />'.
+                                  '<input type="checkbox" name="inststatus_delete" value="'.$item.'" aria-label="'.&mt('Delete institutional user type: [_1]',$title).'" />'.
                                   &mt('delete').'</span></td>'.
                                   '<td class="LC_left_item" colspan="2"><span class="LC_nobreak">'.&mt('Name displayed').':'.
-                                  '<input type="text" size="20" name="inststatus_title_'.$item.'" value="'.$title.'" />'.
+                                  '<input type="text" size="20" name="inststatus_title_'.$item.'" value="'.$title.'" aria-label="'.&mt('Name displayed for institutional user type: [_1]',$item).'"  />'.
                                   '</span></td></tr>';
                 }
-                $css_class = $rownum%2?' class="LC_odd_row"':'';
-                my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'addinststatus_pos'".');"';
-                $datatable .= '<tr '.$css_class.'>'.
-                              '<td><span class="LC_nobreak"><select name="addinststatus_pos"'.$chgstr.'>';
-                for (my $k=0; $k<=$maxnum; $k++) {
-                    my $vpos = $k+1;
-                    my $selstr;
-                    if ($k == $maxnum) {
-                        $selstr = ' selected="selected" ';
-                    }
-                    $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
-                }
-                $datatable .= '</select> '.&mt('Internal ID:').
-                              '<input type="text" size="10" name="addinststatus" value="" />'.
-                              ' '.&mt('(new)').
-                              '</span></td><td class="LC_left_item" colspan="2"><span class="LC_nobreak">'.
-                              &mt('Name displayed').':'.
-                              '<input type="text" size="20" name="addinststatus_title" value="" /></span></td>'.
-                              '</tr>'."\n";
-                $rownum ++;
             }
         }
+        $css_class = $rownum%2?' class="LC_odd_row"':'';
+        my $chgstr = ' onchange="javascript:reorderTypes(this.form,'."'addinststatus_pos'".');"';
+        my $labeltext = &mt('List order for new institutional user type');
+        $datatable .= '<tr '.$css_class.'>'.
+                      '<td><span class="LC_nobreak"><select name="addinststatus_pos"'.$chgstr.' aria-label="'.$labeltext.'">';
+        for (my $k=0; $k<=$maxnum; $k++) {
+            my $vpos = $k+1;
+            my $selstr;
+            if ($k == $maxnum) {
+                $selstr = ' selected="selected" ';
+            }
+            $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
+        }
+        $datatable .= '</select> '.&mt('Internal ID:').
+                      '<input type="text" size="10" name="addinststatus" value="" aria-label="'.&mt('Add new institutional user type').'" />'.
+                      ' '.&mt('(new)').
+                      '</span></td><td class="LC_left_item" colspan="2"><span class="LC_nobreak">'.
+                      &mt('Name displayed').':'.
+                      '<input type="text" size="20" name="addinststatus_title" value="" aria-label="'.&mt('Name displayed for new institutional user type').'" /></span></td>'.
+                      '</tr>'."\n";
+        $rownum ++;
     } else {
         my ($unamemaprules,$ruleorder) =
             &Apache::lonnet::inst_userrules($dom,'unamemap');
         $css_class = $rownum%2?' class="LC_odd_row"':'';
         if ((ref($unamemaprules) eq 'HASH') && (ref($ruleorder) eq 'ARRAY')) {
             my $numinrow = 2;
-            $datatable .= '<tr'.$css_class.'><td>'.&mt('Available conversions').'</td><td><table>'.
-                          &user_formats_row('unamemap',$settings,$unamemaprules,
-                                            $ruleorder,$numinrow).
-                          '</table></td></tr>';
+            if (@{$ruleorder} > 0) {
+                $datatable .= '<tr'.$css_class.'><td>'.&mt('Available conversions').'</td><td>'.
+                              '<div class="LC_grid" role="grid">'.
+                              &user_formats_row('unamemap',$settings,$unamemaprules,
+                                                $ruleorder,$numinrow).
+                              '</div></td></tr>;'
+            }
         }
         if ($datatable eq '') {
             $datatable .= '<tr'.$css_class.'><td colspan="2">'.
@@ -11094,7 +11512,7 @@
             $datatable .= &mt('Upload to library server: [_1]',$switchserver);
         } else {
             $datatable .='<span class="LC_nobreak"> '.
-                         '<input type="file" name="scantronformat" /></span>';
+                         '<input type="file" name="scantronformat" aria-label="'.&mt('Bubblesheet format file to upload').'" /></span>';
         }
     }
     $datatable .= '</td></tr>';
@@ -11168,56 +11586,60 @@
         $checked{'dat'} = $is_checked;
     }
     $onclick{'csv'} = ' onclick="toggleScantron(this.form);"';
+    my $title = &mt('Supported formats');
     my $css_class = $itemcount%2? ' class="LC_odd_row"':'';
-    $datatable = '<tr '.$css_class.'><td>'.&mt('Supported formats').'</td>'.
-                 '<td class="LC_left_item" valign="top"><span class="LC_nobreak">';
+    $datatable = '<tr '.$css_class.'><td>'.$title.'</td>'.
+                 '<td class="LC_left_item" valign="top">'.
+                 '<fieldset class="LC_borderless">'.
+                 '<legend class="LC_visually_hidden">'.$title.'</legend>'.
+                 '<span class="LC_nobreak">';
     foreach my $item ('dat','csv') {
         my $id;
         if ($item eq 'csv') {
             $id = 'id="scantronconfcsv" ';
         }
-        $datatable .= '<label><input type="checkbox" name="scantronconfig" '.$id.'value="'.$item.'"'.$checked{$item}.$onclick{$item}.' />'.
+        $datatable .= '<label><input type="checkbox" name="scantronconfig" '.$id.
+                      'value="'.$item.'"'.$checked{$item}.$onclick{$item}.' />'.
                       $titles{$item}.'</label>'.(' 'x3);
-        if ($item eq 'csv') {
-            $datatable .= '<fieldset style="display:'.$currcsvsty.'" id="scantroncsv_cols">'.
-                          '<legend>'.&mt('CSV Column Mapping').'</legend>'.
-                          '<table><tr><th>'.&mt('Field').'</th><th>'.&mt('Location').'</th></tr>'."\n";
-            foreach my $col (@fields) {
-                my $selnone;
-                if ($csvfields{$col} eq '') {
-                    $selnone = ' selected="selected"';
-                }
-                $datatable .= '<tr><td>'.$titles{$col}.'</td>'.
-                              '<td><select name="scantronconfig_csv_'.$col.'" class="scantronconfig_csv">'.
-                              '<option value=""'.$selnone.'></option>';
-                for (my $i=0; $i<20; $i++) {
-                    my $shown = $i+1;
-                    my $sel;
-                    unless ($selnone) {
-                        if (exists($csvfields{$col})) {
-                            if ($csvfields{$col} == $i) {
-                                $sel = ' selected="selected"';
-                            }
-                        }
+    }
+    $datatable .= '</span></fieldset>'.
+                  '<fieldset style="display:'.$currcsvsty.'" id="scantroncsv_cols">'.
+                  '<legend>'.&mt('CSV Column Mapping').'</legend>'.
+                  '<table><tr><th>'.&mt('Field').'</th><th>'.&mt('Location').'</th></tr>'."\n";
+    foreach my $col (@fields) {
+        my $selnone;
+        if ($csvfields{$col} eq '') {
+            $selnone = ' selected="selected"';
+        }
+        $datatable .= '<tr><td><label for="scantronconfig_csv_'.$col.'">'.$titles{$col}.'</label></td>'.
+                      '<td><select name="scantronconfig_csv_'.$col.'" id="scantronconfig_csv_'.$col.'" class="scantronconfig_csv">'.
+                      '<option value=""'.$selnone.'></option>';
+                      '<option value=""'.$selnone.'></option>';
+        for (my $i=0; $i<20; $i++) {
+            my $shown = $i+1;
+            my $sel;
+            unless ($selnone) {
+                if (exists($csvfields{$col})) {
+                    if ($csvfields{$col} == $i) {
+                        $sel = ' selected="selected"';
                     }
-                    $datatable .= '<option value="'.$i.'"'.$sel.'>'.$shown.'</option>';
                 }
-                $datatable .= '</select></td></tr>';
-           }
-           $datatable .= '</table></fieldset>'.
-                         '<fieldset style="display:'.$currcsvsty.'" id="scantroncsv_options">'.
-                         '<legend>'.&mt('CSV Options').'</legend>';
-           foreach my $option ('hdr','pad','rem') {
-               $datatable .= '<span class="LC_nobreak">'.$titles{$option}.':'.
-                         '<label><input type="radio" name="scantroncsv_'.$option.'" value="1"'.$optionson{$option}.' />'.
-                         &mt('Yes').'</label>'.(' 'x2)."\n".
-                         '<label><input type="radio" name="scantroncsv_'.$option.'" value="0"'.$optionsoff{$option}.' />'.&mt('No').'</label></span><br />';
-           }
-           $datatable .= '</fieldset>';
-           $itemcount ++;
-        }
+            }
+            $datatable .= '<option value="'.$i.'"'.$sel.'>'.$shown.'</option>';
+        }
+        $datatable .= '</select></td></tr>';
+    }
+    $datatable .= '</table></fieldset>'.
+                  '<fieldset style="display:'.$currcsvsty.'" id="scantroncsv_options">'.
+                  '<legend>'.&mt('CSV Options').'</legend>';
+    foreach my $option ('hdr','pad','rem') {
+        $datatable .= '<span class="LC_nobreak">'.$titles{$option}.':'.
+                      '<label><input type="radio" name="scantroncsv_'.$option.'" value="1"'.$optionson{$option}.' />'.
+                      &mt('Yes').'</label>'.(' 'x2)."\n".
+                      '<label><input type="radio" name="scantroncsv_'.$option.'" value="0"'.$optionsoff{$option}.' />'.&mt('No').'</label></span><br />';
     }
-    $datatable .= '</td></tr>';
+    $datatable .= '</fieldset></td></tr>';
+    $itemcount ++;
     $$rowtotal ++;
     return $datatable;
 }
@@ -11273,9 +11695,12 @@
        my $itemcount = 0;
        foreach my $item (@catitems) {
            my $css_class = $itemcount%2? ' class="LC_odd_row"':'';
-           $datatable .= '<tr '.$css_class.'>'.
-                         '<td>'.$lt{$item}.'</td>'.
-                         '<td class="LC_right_item"><span class="LC_nobreak">';
+           $datatable .= '<tr'.$css_class.'>'.
+                         '<td style="line-height: 175%;">'.$lt{$item}.'</td>'.
+                         '<td class="LC_right_item">'.
+                         '<fieldset class="LC_borderless">'.
+                         '<legend class="LC_visually_hidden">'.$lt{$item}.'</legend>'.
+                         '<span class="LC_nobreak">';
            foreach my $type (@cattypes) {
                my $ischecked;
                if ($checked{$item} eq $type) {
@@ -11285,7 +11710,7 @@
                              '<input type="radio" name="coursecat_'.$item.'" value="'.$type.'"'.$ischecked.
                              ' />'.$lt{$type}.'</label> ';
            }
-           $datatable .= '</span></td></tr>';
+           $datatable .= '</span></fieldset></td></tr>';
            $itemcount ++;
         }
         $$rowtotal += $itemcount;
@@ -11344,48 +11769,66 @@
                      place => 'Set in Placement Test',
                     );
         $datatable = '<tr class="LC_odd_row">'.
-                  '<td>'.$title{'togglecats'}.'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  '<td style="line-height: 170%;">'.$title{'togglecats'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$title{'togglecats'}.'</legend>'.
+                  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="togglecats"'.
                   $toggle_cats_dom.' value="dom" />'.$level{'dom'}.'</label> '.
                   '<label><input type="radio" name="togglecats"'.
-                  $toggle_cats_crs.' value="crs" />'.$level{'crs'}.'</label></span></td>'.
-                  '</tr><tr>'.
-                  '<td>'.$title{'categorize'}.'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak">'.
+                  $toggle_cats_crs.' value="crs" />'.$level{'crs'}.'</label></span>'.
+                  '</fieldset></td></tr><tr>'.
+                  '<td style="line-height: 170%;">'.$title{'categorize'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$title{'categorize'}.'</legend>'.
+                  '<span class="LC_nobreak">'.
                   '<label><input type="radio" name="categorize"'.
                   $can_cat_dom.' value="dom" />'.$level{'dom'}.'</label> '.
                   '<label><input type="radio" name="categorize"'.
-                  $can_cat_crs.'value="crs" />'.$level{'crs'}.'</label></span></td>'.
-                  '</tr><tr class="LC_odd_row">'.
-                  '<td>'.$title{'togglecatscomm'}.'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  $can_cat_crs.'value="crs" />'.$level{'crs'}.'</label></span>'.
+                  '</fieldset></td></tr><tr class="LC_odd_row">'.
+                  '<td style="line-height: 170%;">'.$title{'togglecatscomm'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$title{'togglecatscomm'}.'</legend>'.
+		  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="togglecatscomm"'.
                   $toggle_catscomm_dom.' value="dom" />'.$level{'dom'}.'</label> '.
                   '<label><input type="radio" name="togglecatscomm"'.
-                  $toggle_catscomm_comm.' value="comm" />'.$level{'comm'}.'</label></span></td>'.
-                  '</tr><tr>'.
-                  '<td>'.$title{'categorizecomm'}.'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak">'.
+                  $toggle_catscomm_comm.' value="comm" />'.$level{'comm'}.'</label></span>'.
+                  '</fieldset></td></tr><tr>'.
+                  '<td style="line-height: 170%;">'.$title{'categorizecomm'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$title{'categorizecomm'}.'</legend>'.
+                  '<span class="LC_nobreak">'.
                   '<label><input type="radio" name="categorizecomm"'.
                   $can_catcomm_dom.' value="dom" />'.$level{'dom'}.'</label> '.
                   '<label><input type="radio" name="categorizecomm"'.
-                  $can_catcomm_comm.'value="comm" />'.$level{'comm'}.'</label></span></td>'.
-                  '</tr><tr class="LC_odd_row">'.
-                  '<td>'.$title{'togglecatsplace'}.'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak"><label>'.
+                  $can_catcomm_comm.'value="comm" />'.$level{'comm'}.'</label></span>'.
+                  '</fieldset></td></tr><tr class="LC_odd_row">'.
+                  '<td style="line-height: 170%;">'.$title{'togglecatsplace'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$title{'togglecatsplace'}.'</legend>'.
+                  '<span class="LC_nobreak"><label>'.
                   '<input type="radio" name="togglecatsplace"'.
                   $toggle_catsplace_dom.' value="dom" />'.$level{'dom'}.'</label> '.
                   '<label><input type="radio" name="togglecatscomm"'.
-                  $toggle_catsplace_place.' value="comm" />'.$level{'place'}.'</label></span></td>'.
-                  '</tr><tr>'.
-                  '<td>'.$title{'categorizeplace'}.'</td>'.
-                  '<td class="LC_right_item"><span class="LC_nobreak">'.
+                  $toggle_catsplace_place.' value="comm" />'.$level{'place'}.'</label></span>'.
+                  '</fieldset></td></tr><tr>'.
+                  '<td style="line-height: 170%;">'.$title{'categorizeplace'}.'</td>'.
+                  '<td class="LC_right_item">'.
+                  '<fieldset class="LC_borderless">'.
+                  '<legend class="LC_visually_hidden">'.$title{'categorizeplace'}.'</legend>'.
+                  '<span class="LC_nobreak">'.
                   '<label><input type="radio" name="categorizeplace"'.
                   $can_catplace_dom.' value="dom" />'.$level{'dom'}.'</label> '.
                   '<label><input type="radio" name="categorizeplace"'.
-                  $can_catplace_place.'value="place" />'.$level{'place'}.'</label></span></td>'.
-                  '</tr>';
+                  $can_catplace_place.'value="place" />'.$level{'place'}.'</label></span>'.
+                  '</fieldset></td></tr>';
         $$rowtotal += 6;
     } else {
         my $css_class;
@@ -11427,10 +11870,17 @@
                         my $parent = $cats[0][$i];
                         $css_class = $itemcount%2?' class="LC_odd_row"':'';
                         my $item = &escape($parent).'::0';
+                        my $shownum = $i+1;
                         my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$item','$idx{$item}'".');"';
+                        my $labeltext;
+			if ($parent eq 'instcode' || $parent eq 'communities' || $parent eq 'placement') {
+                            $labeltext = &mt('Set order for item [_1] in [_2]',$shownum,$default_names{$parent});
+                        } else {
+                            $labeltext = &mt('Set order for item [_1] with parent: [_2]',$shownum,$parent); 
+                        }
                         $lastidx = $idx{$item};
-                        $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'
-                                      .'<select name="'.$item.'"'.$chgstr.'>';
+                        $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak">'
+                                      .'<select name="'.$item.'"'.$chgstr.' aria-label="'.$labeltext.'">';
                         for (my $k=0; $k<=$maxnum; $k++) {
                             my $vpos = $k+1;
                             my $selstr;
@@ -11447,8 +11897,13 @@
                                 $datatable .= '<br /><span class="LC_nobreak">('
                                               .&mt('with institutional codes')
                                               .')</span></td><td'.$colattrib.'>';
-                            } else {
-                                $datatable .= '<table><tr><td>';
+                            }
+                            $datatable .= '<fieldset class="LC_borderless" style="line-height: 175%;">'
+                                         .'<legend class="LC_visually_hidden">'.$default_names{$parent}.'</legend>';
+                            if (($parent eq 'communities') || ($parent eq 'placement')) {
+                                $datatable .= '<div class="LC_grid" role="grid">'.
+                                              '<div class="LC_grid_row" role="row">'.
+                                              '<div class="LC_grid_cell" role="gridcell">'; 
                             }
                             $datatable .= '<span class="LC_nobreak">'
                                           .'<label><input type="radio" name="'
@@ -11457,16 +11912,18 @@
                             if ($parent eq 'instcode') {
                                 $datatable .= ' ';
                             } else {
-                                $datatable .= '</span></td></tr><tr><td>'
-                                              .'<span class="LC_nobreak">';
+                                $datatable .= '</span></div></div>'.
+                                              '<div class="LC_grid_row" role="row">'.
+                                              '<div class="LC_grid_cell" role="gridcell">'.
+                                              '<span class="LC_nobreak">';
                             }
                             $datatable .= '<label><input type="radio" name="'
                                           .$parent.'" value="0" />'
                                           .&mt('Do not display').'</label></span>';
                             if (($parent eq 'communities') || ($parent eq 'placement')) {
-                                $datatable .= '</td></tr></table>';
+                                $datatable .= '</div></div></div>';
                             }
-                            $datatable .= '</td>';
+                            $datatable .= '</fieldset></td>';
                         } else {
                             $datatable .= $parent
                                           .' <span class="LC_nobreak"><label>'
@@ -11482,7 +11939,8 @@
                     }
                     $css_class = $itemcount%2?' class="LC_odd_row"':'';
                     my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','$lastidx'".');"';
-                    $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak"><select name="addcategory_pos"'.$chgstr.'>';
+                    my $arialabel = &mt('Set order for new top level category'); 
+                    $datatable .= '<tr'.$css_class.'><td><span class="LC_nobreak"><select name="addcategory_pos"'.$chgstr.' aria-label="'.$arialabel.'">';
                     for (my $k=0; $k<=$maxnum; $k++) {
                         my $vpos = $k+1;
                         my $selstr;
@@ -11491,16 +11949,17 @@
                         }
                         $datatable .= '<option value="'.$k.'"'.$selstr.'>'.$vpos.'</option>';
                     }
-                    $datatable .= '</select></span></td><td colspan="2">'.&mt('Add category:').' '
-                                  .'<input type="text" size="20" name="addcategory_name" value="" /></td>'
+                    $datatable .= '</select></span></td><td colspan="2"><label>'.&mt('Add category:').' '
+                                  .'<input type="text" size="20" name="addcategory_name" value="" /></label></td>'
                                   .'</tr>'."\n";
                     $itemcount ++;
                     foreach my $default ('instcode','communities','placement') {
                         if ((!grep(/^\Q$default\E$/,@{$cats[0]})) || ($cathash->{$default.'::0'} eq '')) {
                             $css_class = $itemcount%2?' class="LC_odd_row"':'';
                             my $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$default"."_pos','$lastidx'".');"';
-                            $datatable .= '<tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr><tr '.$css_class.'><td>'.
-                                          '<span class="LC_nobreak"><select name="'.$default.'_pos"'.$chgstr.'>';
+                            my $labeltext = &mt('Set order for category [_1]',$default_names{$default});
+                            $datatable .= '<tr><td colspan="'.$maxdepth.'" class="LC_row_separator"></td></tr><tr'.$css_class.'><td>'.
+                                          '<span class="LC_nobreak"><select name="'.$default.'_pos"'.$chgstr.' aria-label="'.$labeltext.'">';
                             for (my $k=0; $k<=$maxnum; $k++) {
                                 my $vpos = $k+1;
                                 my $selstr;
@@ -11517,10 +11976,12 @@
                                               .&mt('with institutional codes').')</span>';
                             }
                             $datatable .= '</td>'
-                                          .'<td><span class="LC_nobreak"><label><input type="radio" name="'.$default.'" value="1" />'
+                                          .'<td><fieldset class="LC_borderless" style="line-height: 175%;">'
+                                          .'<legend class="LC_visually_hidden">'.$default_names{$default}.'</legend>'
+					  .'<span class="LC_nobreak"><label><input type="radio" name="'.$default.'" value="1" />'
                                           .&mt('Display').'</label> '
                                           .'<label><input type="radio" name="'.$default.'" value="0" checked="checked"/>'
-                                          .&mt('Do not display').'</label></span></td></tr>';
+                                          .&mt('Do not display').'</label></span></fieldset></td></tr>';
                         }
                     }
                 }
@@ -11528,8 +11989,7 @@
                 $datatable .= &initialize_categories($itemcount);
             }
         } else {
-            $datatable .= '<tr><td class="LC_right_item">'.$hdritem->{'header'}->[1]->{'col2'}.'</td></tr>'
-                          .&initialize_categories($itemcount);
+            $datatable .= &initialize_categories($itemcount);
         }
         $$rowtotal += $itemcount;
     }
@@ -11567,15 +12027,15 @@
         $rownum ++;
         $css_class = $rownum%2?' class="LC_odd_row"':'';
         $datatable .= '<tr'.$css_class.'>'.
-                      '<td><span class="LC_nobreak">'.
-                      $titles->{$type}.'</span></td>'.
+                      '<th id="statusrow'.$rownum.'" scope="row" class="LC_rowheader">'.
+		      '<span class="LC_nobreak">'.$titles->{$type}.'</span></th>'.
                       '<td class="LC_left_item">'.
                       '<input type="text" name="'.$type.'_namedusers" '.
-                      'value="'.$namedaccess{$type}.'" size="30" /></td>'.
+                      'value="'.$namedaccess{$type}.'" size="30" aria-labelledby="colheader2 statusrow'.$rownum.'" /></td>'.
                       '<td class="LC_right_item">'.
                       '<span class="LC_nobreak">'.
                       '<input type="text" name="'.$type.'_machines" '.
-                      'value="'.$machineaccess{$type}.'" size="10" />'.
+                      'value="'.$machineaccess{$type}.'" size="10" aria-labelledby="colheader3 statusrow'.$rownum.'" />'.
                       '</span></td></tr>'."\n";
     }
     $$rowtotal += $rownum;
@@ -11902,30 +12362,36 @@
         $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','$default"."_pos','0'".');"';
         map { $selected{$selnum{$_}} = '' } keys(%selnum);
         $selected{$selnum{$default}} = ' selected="selected"';
+        my $labeltext = &mt('Set order for category: [_1]',$default_names{$default});
         $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'
-                     .'<select name="'.$default.'_pos"'.$chgstr.'>'
+                     .'<select name="'.$default.'_pos"'.$chgstr.' aria-label="'.$labeltext.'">'
                      .'<option value="0"'.$selected{'0'}.'>1</option>'
                      .'<option value="1"'.$selected{'1'}.'>2</option>'
                      .'<option value="2"'.$selected{'2'}.'>3</option>'
                      .'<option value="3">4</option></select> '
                      .$default_names{$default}
-                     .'</span></td><td><span class="LC_nobreak">'
+                     .'</span></td><td colspan="2" class="LC_left_item">'
+                     .'<fieldset class="LC_borderless" style="line-height: 175%;">'
+                     .'<legend class="LC_visually_hidden">'.$default_names{$default}.'</legend>'
+                     .'<span class="LC_nobreak">'
                      .'<label><input type="radio" name="'.$default.'" value="1" checked="checked" />'
                      .&mt('Display').'</label> <label>'
                      .'<input type="radio" name="'.$default.'" value="0" />'.&mt('Do not display')
-                 .'</label></span></td></tr>';
+                     .'</label></span></fieldset></td></tr>';
         $itemcount ++;
     }
     $css_class = $itemcount%2?' class="LC_odd_row"':'';
     $chgstr = ' onchange="javascript:reorderCats(this.form,'."'','addcategory_pos','0'".');"';
+    my $addcat = &mt('Add category');
+    my $arialabel = &mt('Set order for new top level category');
     $datatable .= '<tr '.$css_class.'><td><span class="LC_nobreak">'
-                  .'<select name="addcategory_pos"'.$chgstr.'>'
+                  .'<select name="addcategory_pos"'.$chgstr.' aria-label="'.$arialabel.'">'
                   .'<option value="0">1</option>'
                   .'<option value="1">2</option>'
                   .'<option value="2">3</option>'
                   .'<option value="3" selected="selected">4</option></select> '
-                  .&mt('Add category').'</span></td><td><span class="LC_nobreak">'.&mt('Name:')
-                  .' <input type="text" size="20" name="addcategory_name" value="" /></span>'
+                  .$addcat.'</span></td><td><span class="LC_nobreak" colspan="2">'.&mt('Name:')
+                  .' <input type="text" size="20" name="addcategory_name" value="" aria-label="'.$addcat.'" /></span>'
                   .'</td></tr>';
     return $datatable;
 }
@@ -11938,8 +12404,10 @@
         if (ref($cats->[$depth]) eq 'HASH') {
             if (ref($cats->[$depth]{$parent}) eq 'ARRAY') {
                 my $numchildren = @{$cats->[$depth]{$parent}};
-                my $css_class = $itemcount%2?' class="LC_odd_row"':'';
-                $text .= '<td><table class="LC_data_table">';
+                $text = '<td><table style="margin: 0; border: 1px solid black;">'.
+                        '<tr class="LC_visually_hidden">'.
+                        '<th>'.&mt('Subcategory Names').'</th>'.
+                        '<th colspan="2">'.&mt('Contents').'</th></tr>';
                 my ($idxnum,$parent_name,$parent_item);
                 my $higher = $depth - 1;
                 if ($higher == 0) {
@@ -11959,8 +12427,11 @@
                         $name = $parent_name;
                         $item = $parent_item;
                     }
+                    my $shownum = $j+1;
+                    my $label = &mt('Set order for item [_1] in parent [_2]',$shownum,$parent);
                     $chgstr = ' onchange="javascript:reorderCats(this.form,'."'$parent_name','$item','$idxnum'".');"';
-                    $text .= '<tr '.$css_class.'><td><span class="LC_nobreak"><select name="'.$item.'"'.$chgstr.'>';
+                    $text .= '<tr><td style="line-height: 200%;"><span class="LC_nobreak">'.
+                             '<select name="'.$item.'"'.$chgstr.' aria-label="'.$label.'">';
                     for (my $i=0; $i<=$numchildren; $i++) {
                         my $vpos = $i+1;
                         my $selstr;
@@ -11974,22 +12445,23 @@
                         my $deeper = $depth+1;
                         $text .= $name.' '
                                  .'<label><input type="checkbox" name="deletecategory" value="'
-                                 .$item.'" />'.&mt('Delete').'</label></span></td><td>';
+                                 .$item.'" />'.&mt('Delete').'</label></span></td>';
                         if(ref($path) eq 'ARRAY') {
                             push(@{$path},$name);
                             $text .= &build_category_rows($itemcount,$cats,$deeper,$name,$path,$idx);
                             pop(@{$path});
                         }
                     } else {
-                        $text .= &mt('Add subcategory:').' </span><input type="text" size="20" name="addcategory_name_';
+                        my $elemname = 'addcategory_name_'; 
                         if ($j == $numchildren) {
-                            $text .= $name;
+                            $elemname .= $name;
                         } else {
-                            $text .= $item;
+                            $elemname .= $item;
                         }
-                        $text .= '" value="" />';
+                        $text .= '<label for="'.$elemname.'">'.&mt('Add subcategory:').'</label> </span>'.
+                                 '<input type="text" size="20" name="'.$elemname.'" id="'.$elemname.'" value="" /></td>';
                     }
-                    $text .= '</td></tr>';
+                    $text .= '</tr>';
                 }
                 $text .= '</table></td>';
             } else {
@@ -12004,7 +12476,10 @@
                 my $colspan;
                 if ($parent ne 'instcode') {
                     $colspan = $maxdepth - $depth - 1;
-                    $text .= '<td colspan="'.$colspan.'">'.&mt('Add subcategory:').'<input type="text" size="20" name="subcat_'.$name.'" value="" /></td>';
+                    $text .= '<td colspan="'.$colspan.'">'.
+                             '<label>'.&mt('Add subcategory:').
+                             '<input type="text" size="20" name="subcat_'.$name.'" value="" />'.
+                             '</label></td>';
                 }
             }
         }
@@ -12076,9 +12551,16 @@
     if ($rowid) {
         $rowid = ' id="'.$rowid.'"';
     }
-    $output = '<tr '.$css_class.$rowid.'>'.
-              '<td><span class="LC_nobreak">'.$rolename.'</span></td>'.
-              '<td class="LC_left_item" colspan="2"><table>';
+    $output = '<tr '.$css_class.$rowid.'>';
+    if ($context eq 'lti') {
+        $output .= '<th class="LC_rowheader" scope="row"><span class="LC_nobreak">'.$rolename.'</span></th>';
+    } else {
+        $output .= '<td><span class="LC_nobreak">'.$rolename.'</span></td>';
+    }
+    $output .= '<td class="LC_left_item" colspan="2">'.
+               '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+               '<legend class="LC_visually_hidden">'.$rolename.'</legend>'.
+               '<div class="LC_grid" role="grid">';
     my $rem;
     my %checks;
     if (ref($settings) eq 'HASH') {
@@ -12127,9 +12609,9 @@
         $rem = $i%($numinrow);
         if ($rem == 0) {
             if ($i > 0) {
-                $output .= '</tr>';
+                $output .= '</div>';
             }
-            $output .= '<tr>';
+            $output .= '<div class="LC_grid_row" role="row">';
         }
         my $check = ' ';
         unless ($role eq 'emailusername') {
@@ -12161,7 +12643,7 @@
                 }
             }
         }
-        $output .= '<td class="LC_left_item">'.
+        $output .= '<div class="LC_grid_cell" role="gridcell">'.
                    '<span class="LC_nobreak">';
         my $prefix = 'canmodify';
         if ($role eq 'emailusername') {
@@ -12191,20 +12673,9 @@
                        'value="'.$fields[$i].'"'.$check.'/>'.$fieldtitles{$fields[$i]}.
                        '</label>';
         }
-        $output .= '</span></td>';
-    }
-    $rem = $total%$numinrow;
-    my $colsleft;
-    if ($rem) {
-        $colsleft = $numinrow - $rem;
-    }
-    if ($colsleft > 1) {
-        $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">'.
-                   ' </td>';
-    } elsif ($colsleft == 1) {
-        $output .= '<td class="LC_left_item"> </td>';
+        $output .= '</span></div>';
     }
-    $output .= '</tr></table></td></tr>';
+    $output .= '</div></div></fieldset></td></tr>';
     return $output;
 }
 
@@ -12249,7 +12720,10 @@
     }
     my $output = '<tr'.$css_class.'>'.
                  '<td>'.$lt{$context}.$showdom.
-                 '</td><td class="'.$class.'" colspan="2"><table>';
+                 '</td><td class="'.$class.'" colspan="2">'.
+                 '<fieldset class="LC_borderless" style="margin: 0;">'.
+                 '<legend class="LC_visually_hidden">'.&mt('Select affiliations').'</legend>'.
+                 '<div class="LC_grid" role="grid" style="margin: 0;">';
     my $rem;
     if (ref($types) eq 'ARRAY') {
         for (my $i=0; $i<@{$types}; $i++) {
@@ -12257,9 +12731,9 @@
                 my $rem = $i%($numinrow);
                 if ($rem == 0) {
                     if ($i > 0) {
-                        $output .= '</tr>';
+                        $output .= '</div>';
                     }
-                    $output .= '<tr>';
+                    $output .= '<div class="LC_grid_row" role="row">';
                 }
                 if ($context eq 'authorquota') {
                     my $currquota;
@@ -12268,12 +12742,12 @@
                     } else {
                         $currquota = $defaultquota;
                     }
-                    $output .= '<td class="LC_left_item">'."\n".
+                    $output .= '<div class="LC_grid_cell" role="gridcell">'."\n".
                                '<label><span class="LC_nobreak">'."\n".
                                $usertypes->{$types->[$i]}.'</span><br />'."\n".
                                '<input type="text" name="'.$context.'_'.$types->[$i].'" '.
                                'value="'.$currquota.'" size="5"'.$onclick.'/>'."\n".
-                               '</label></td>';
+                               '</label></div>';
                 } else {
                     my $check = ' ';
                     if (ref($settings) eq 'HASH') {
@@ -12293,33 +12767,23 @@
                             $check = ' checked="checked" ';
                         }
                     }
-                    $output .= '<td class="LC_left_item">'.
+                    $output .= '<div class="LC_grid_cell" role="gridcell">'.
                                '<span class="LC_nobreak"><label>'.
                                '<input type="checkbox" name="'.$context.'" '.
                                'value="'.$types->[$i].'"'.$check.$onclick.'/>'.
-                               $usertypes->{$types->[$i]}.'</label></span></td>';
+                               $usertypes->{$types->[$i]}.'</label></span></div>';
                 }
             }
         }
         $rem = @{$types}%($numinrow);
     }
-    my $colsleft = $numinrow - $rem;
     if ($context eq 'overrides') {
-        if ($colsleft > 1) {
-            $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
-        } else {
-            $output .= '<td class="LC_left_item">';
-        }
-        $output .= ' ';
+        $output .= '<div class="LC_grid_cell" role="gridcell"> ';
     } else {
         if ($rem == 0) {
-            $output .= '<tr>';
-        }
-        if ($colsleft > 1) {
-            $output .= '<td colspan="'.$colsleft.'" class="LC_left_item">';
-        } else {
-            $output .= '<td class="LC_left_item">';
+            $output .= '</div><div class="LC_grid_row" role="row">';
         }
+        $output .= '<div class="LC_grid_cell" role="gridcell">';
         if ($context eq 'authorquota') {
             my $currquota = 500;
             if ((ref($settings) eq 'HASH') && (ref($settings->{$context}) eq 'HASH')) {
@@ -12356,7 +12820,7 @@
                        $othertitle.'</label></span>';
         }
     }
-    $output .= '</td></tr></table></td></tr>';
+    $output .= '</div></div></div></fieldset></td></tr>';
     return $output;
 }
 
@@ -12389,14 +12853,17 @@
             $$rownums ++;
             my $css_class = $$rownums%2?' class="LC_odd_row"':'';
             $datatable .= '<tr'.$css_class.'><td>'.$usertypes->{$type}.
-                          '</td><td class="LC_left_item"><table>';
+                          '</td><td class="LC_left_item">'.
+                          '<fieldset class="LC_borderless" style="margin: 0;">'.
+                          '<legend class="LC_visually_hidden">'.&mt('Choose user data fields').'</legend>'.
+                          '<div class="LC_grid" role="grid" style="margin: 0;">';
             for (my $i=0; $i<@{$fields}; $i++) {
                 my $rem = $i%($numinrow);
                 if ($rem == 0) {
                     if ($i > 0) {
-                        $datatable .= '</tr>';
+                        $datatable .= '</div>';
                     }
-                    $datatable .= '<tr>';
+                    $datatable .= '<div class="LC_grid_row" role="row">';
                 }
                 my $check = ' ';
                 if (ref($settings) eq 'HASH') {
@@ -12408,23 +12875,13 @@
                         }
                     }
                 }
-
-                if ($i == @{$fields}-1) {
-                    my $colsleft = $numinrow - $rem;
-                    if ($colsleft > 1) {
-                        $datatable .= '<td colspan="'.$colsleft.'">';
-                    } else {
-                        $datatable .= '<td>';
-                    }
-                } else {
-                    $datatable .= '<td>';
-                }
-                $datatable .= '<span class="LC_nobreak"><label>'.
+                $datatable .= '<div class="LC_grid_cell" role="gridcell">'.
+                              '<span class="LC_nobreak"><label>'.
                               '<input type="checkbox" name="updateable_'.$type.
                               '_'.$fields->[$i].'" value="1"'.$check.'/>'.
-                              $fieldtitles->{$fields->[$i]}.'</label></span></td>';
+                              $fieldtitles->{$fields->[$i]}.'</label></span></div>';
             }
-            $datatable .= '</tr></table></td></tr>';
+            $datatable .= '</div></div></fieldset></td></tr>';
         }
     }
     return $datatable;
@@ -13086,6 +13543,7 @@
             bgs => "Background colors",
             links => "Link colors",
             images => "Images",
+            alerts => "Alerts",
             font => "Font color",
             fontmenu => "Font menu",
             pgbg => "Page",
@@ -13094,6 +13552,10 @@
             link => "Link",
             alink => "Active link",
             vlink => "Visited link",
+            info => "Info",
+            warning => "Warning",
+            error => "Error",
+            success => "Success",
         );
     return %choices;
 }
@@ -13660,10 +14122,8 @@
 sub modify_colors {
     my ($r,$dom,$confname,$roles,$domconfig,$confhash) = @_;
     my (%changes,%choices);
-    my @bgs;
+    my (@bgs, at logintext, at images, at alerts);
     my @links = ('link','alink','vlink');
-    my @logintext;
-    my @images;
     my $servadm = $r->dir_config('lonAdmEMail');
     my $errors;
     my %defaults;
@@ -13671,17 +14131,16 @@
         if ($role eq 'login') {
             %choices = &login_choices();
             @logintext = ('textcol','bgcol');
-        } else {
-            %choices = &color_font_choices();
-        }
-        if ($role eq 'login') {
             @images = ('img','logo','domlogo','login');
             @bgs = ('pgbg','mainbg','sidebg');
+            @alerts = ();
         } else {
+            %choices = &color_font_choices();
             @images = ();
             @bgs = ('pgbg','tabbg','sidebg');
+            @alerts = ('error','warning','info','success');
         }
-        my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@logintext);
+        my %defaults = &role_defaults($role,\@bgs,\@links,\@images,\@alerts,\@logintext);
         $env{'form.'.$role.'_font'} = lc($env{'form.'.$role.'_font'});
         if ($env{'form.'.$role.'_font'} =~ /^\w+/) {
             $env{'form.'.$role.'_font'} = '#'.$env{'form.'.$role.'_font'};
@@ -13726,6 +14185,15 @@
                 $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
             }
         }
+        foreach my $item (@alerts) {
+            $env{'form.'.$role.'_'.$item} = lc($env{'form.'.$role.'_'.$item});
+            if ($env{'form.'.$role.'_'.$item} =~ /^\w+/) {
+                $env{'form.'.$role.'_'.$item} = '#'.$env{'form.'.$role.'_'.$item};
+            }
+            unless ($env{'form.'.$role.'_'.$item} eq lc($defaults{'alerts'}{$item})) {
+                $confhash->{$role}{$item} = $env{'form.'.$role.'_'.$item};
+            }
+        }
         my ($configuserok,$author_ok,$switchserver) = 
             &config_check($dom,$confname,$servadm);
         my ($width,$height) = &thumb_dimensions();
@@ -13871,6 +14339,17 @@
                             $changes{$role}{'fontmenu'} = 1;
                         }
                     }
+                    foreach my $item (@alerts) {
+                        if ($domconfig->{$role}{$item} ne '') {
+                            if ($confhash->{$role}{$item} ne $domconfig->{$role}{$item}) {
+                                $changes{$role}{'alerts'}{$item} = 1;
+                            }
+                        } else {
+                            if ($confhash->{$role}{$item}) {
+                                $changes{$role}{'alerts'}{$item} = 1;
+                            }
+                        }
+                    }
                 }
                 foreach my $item (@bgs) {
                     if ($domconfig->{$role}{$item} ne '') {
@@ -13907,11 +14386,11 @@
                 }
             } else {
                 &default_change_checker($role,\@images,\@links,\@bgs,
-                                        \@logintext,$confhash,\%changes); 
+                                        \@logintext,\@alerts,$confhash,\%changes); 
             }
         } else {
             &default_change_checker($role,\@images,\@links,\@bgs,
-                                    \@logintext,$confhash,\%changes); 
+                                    \@logintext,\@alerts,$confhash,\%changes); 
         }
     }
     return ($errors,%changes);
@@ -13933,7 +14412,7 @@
 }
 
 sub default_change_checker {
-    my ($role,$images,$links,$bgs,$logintext,$confhash,$changes) = @_;
+    my ($role,$images,$links,$bgs,$logintext,$alerts,$confhash,$changes) = @_;
     foreach my $item (@{$links}) {
         if ($confhash->{$role}{$item}) {
             $changes->{$role}{'links'}{$item} = 1;
@@ -21257,19 +21736,19 @@
     my ($dom,$lastactref,%domconfig) = @_;
     my ($resulttext,$errors,%changes,%defaultshash);
     my %defaultchecked = (
-                           'canuse_pdfforms' => 'off',
+                           'canuse_pdfforms' => '0',
                            'uselcmath'       => 'on',
                            'usejsme'         => 'on',
                            'inline_chem'     => 'on',
                            'ltiauth'         => 'off',
                          );
-    my @toggles = ('canuse_pdfforms','uselcmath','usejsme','inline_chem','ltiauth');
+    my @toggles = ('uselcmath','usejsme','inline_chem','ltiauth');
     my @numbers = ('anonsurvey_threshold','uploadquota_official','uploadquota_unofficial',
                    'uploadquota_community','uploadquota_textbook','uploadquota_placement',
                    'coursequota_official','coursequota_unofficial','coursequota_community',
                    'coursequota_textbook','coursequota_placement','mysqltables_official',
                    'mysqltables_unofficial','mysqltables_community','mysqltables_textbook',
-                   'mysqltables_placement');
+                   'mysqltables_placement','maxsizepdfform');
     my @types = ('official','unofficial','community','textbook','placement');
     my %staticdefaults = (
                            anonsurvey_threshold => 10,
@@ -21280,12 +21759,18 @@
                            domexttool           => 1,
                            crsauthor            => 1,
                            crseditors           => ['edit','xml'],
+                           maxsizepdfform       => 5,
                          );
     my %texoptions = (
                         MathJax  => 'MathJax',
                         mimetex  => &mt('Convert to Images'),
                         tth      => &mt('TeX to HTML'),
                      );
+    my %pdftext = &Apache::lonlocal::texthash (
+                        2 => 'Yes, including checkboxes',
+                        1 => 'Yes, excluding checkboxes',
+                        0 => 'No',
+    );
 
     my @editors = ('edit','xml','daxe');
     my %editornames = &crseditor_titles();
@@ -21327,6 +21812,18 @@
                     $newdef = 1;
                 }
                 $defaultshash{'coursedefaults'}{$item} = $newdef;
+            } elsif ($item eq 'maxsizepdfform') {
+                $currdef = $domconfig{'coursedefaults'}{$item};
+                $newdef =~ s/^\s+|\s+$//g;
+                if (($newdef =~ /^\d+$/) || ($newdef =~ /^\d+\.\d*$/) || ($newdef =~ /^\.\d+$/)) {
+                    $defaultshash{'coursedefaults'}{$item} = $newdef;
+                } else {
+                    if ($currdef eq '') {
+                        $defaultshash{'coursedefaults'}{$item} = $staticdefaults{'maxsizepdfform'};
+                    } else {
+                        $defaultshash{'coursedefaults'}{$item} = $currdef;
+                    }
+                }
             } else {
                 my ($setting,$type) = ($item =~ /^(uploadquota|coursequota|mysqltables)_(\w+)$/);
                 if (ref($domconfig{'coursedefaults'}{$setting}) eq 'HASH') {
@@ -21336,7 +21833,7 @@
                 $defaultshash{'coursedefaults'}{$setting}{$type} = $newdef;
             }
             if ($currdef ne $newdef) {
-                if ($item eq 'anonsurvey_threshold') {
+                if (($item eq 'anonsurvey_threshold') || ($item eq 'maxsizepdfform')) {
                     unless (($currdef eq '') && ($newdef == $staticdefaults{$item})) {
                         $changes{$item} = 1;
                     }
@@ -21363,6 +21860,17 @@
         if ($texengine ne '') {
             $defaultshash{'coursedefaults'}{'texengine'} = $texengine;
         }
+        if ($env{'form.canuse_pdfforms'} =~ /^(0|1|2)$/) {
+            my $curr = $domconfig{'coursedefaults'}{'canuse_pdfforms'};
+            if ($curr eq '') {
+                unless ($curr eq $defaultchecked{'canuse_pdfforms'}) {
+                    $changes{'canuse_pdfforms'} = 1;
+                }
+            } elsif ($curr ne $env{'form.canuse_pdfforms'}) {
+                $changes{'canuse_pdfforms'} = 1;
+            }
+            $defaultshash{'coursedefaults'}{'canuse_pdfforms'} = $env{'form.canuse_pdfforms'};
+        }
         my $currclone = $domconfig{'coursedefaults'}{'canclone'};
         my @currclonecode;
         if (ref($currclone) eq 'HASH') {
@@ -21569,9 +22077,10 @@
                 ($changes{'coursecredits'}) || ($changes{'uselcmath'}) || ($changes{'usejsme'}) ||
                 ($changes{'canclone'}) || ($changes{'mysqltables'}) || ($changes{'texengine'}) ||
                 ($changes{'inline_chem'}) || ($changes{'ltiauth'}) || ($changes{'domexttool'}) ||
-                ($changes{'exttool'}) || ($changes{'coursequota'}) || ($changes{'crsauthor'})) {
+                ($changes{'exttool'}) || ($changes{'coursequota'}) || ($changes{'crsauthor'}) ||
+                ($changes{'maxsizepdfform'})) {
                 foreach my $item ('canuse_pdfforms','uselcmath','usejsme','inline_chem','texengine',
-                                  'ltiauth') {
+                                  'ltiauth','maxsizepdfform') {
                     if ($changes{$item}) {
                         $domdefaults{$item}=$defaultshash{'coursedefaults'}{$item};
                     }
@@ -21656,11 +22165,15 @@
             $resulttext = &mt('Changes made:').'<ul>';
             foreach my $item (sort(keys(%changes))) {
                 if ($item eq 'canuse_pdfforms') {
-                    if ($env{'form.'.$item} eq '1') {
-                        $resulttext .= '<li>'.&mt("Course/Community users can create/upload PDF forms set to 'on'").'</li>';
+                    if ($env{'form.'.$item} eq '2') {
+                        $resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "Yes, including checkboxes".').'</li>';
+                    } elsif ($env{'form.'.$item} eq '1') {
+                        $resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "Yes, excluding checkboxes".').'</li>';
                     } else {
-                        $resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "off"').'</li>';
+                        $resulttext .= '<li>'.&mt('Course/Community users can create/upload PDF forms set to "No".').'</li>';
                     }
+                } elsif ($item eq 'maxsizepdfform') {
+                    $resulttext .= '<li>'.&mt('Maximum upload size for a fillable forms PDF set to [_1].',$defaultshash{'coursedefaults'}{'maxsizepdfform'}).'</li>';
                 } elsif ($item eq 'uselcmath') {
                     if ($env{'form.'.$item} eq '1') {
                         $resulttext .= '<li>'.&mt('Math preview uses LON-CAPA previewer (javascript), if supported by browser.').'</li>';
@@ -23450,7 +23963,7 @@
 }
 
 sub active_dc_picker {
-    my ($dom,$numinrow,$inputtype,$name,%currhash) = @_;
+    my ($dom,$numinrow,$inputtype,$name,$legend,%currhash) = @_;
     my %domcoords = &Apache::lonnet::get_active_domroles($dom,['dc']);
     my @domcoord = keys(%domcoords);
     if (keys(%currhash)) {
@@ -23465,14 +23978,16 @@
     my $rows = 0;
     my $table;
     if ($numdcs > 1) {
-        $table = '<table>';
+        $table = '<fieldset class="LC_borderless" style="line-height: 170%;">'.
+                 '<legend class="LC_visually_hidden">'.$legend.'</legend>'.
+                 '<div class="LC_grid" role="grid">';
         for (my $i=0; $i<@domcoord; $i++) {
             my $rem = $i%($numinrow);
             if ($rem == 0) {
                 if ($i > 0) {
-                    $table .= '</tr>';
+                    $table .= '</div>';
                 }
-                $table .= '<tr>';
+                $table .= '<div class="LC_grid_row" role="row">';
                 $rows ++;
             }
             my $check = '';
@@ -23489,16 +24004,7 @@
                     $check = ' checked="checked"';
                 }
             }
-            if ($i == @domcoord - 1) {
-                my $colsleft = $numinrow - $rem;
-                if ($colsleft > 1) {
-                    $table .= '<td class="LC_left_item" colspan="'.$colsleft.'">';
-                } else {
-                    $table .= '<td class="LC_left_item">';
-                }
-            } else {
-                $table .= '<td class="LC_left_item">';
-            }
+            $table .= '<div class="LC_grid_cell" role="gridcell">';
             my ($dcname,$dcdom) = split(':',$domcoord[$i]);
             my $user = &Apache::loncommon::plainname($dcname,$dcdom);
             $table .= '<span class="LC_nobreak"><label>'.
@@ -23507,9 +24013,9 @@
             if ($user ne $dcname.':'.$dcdom) {
                 $table .=  ' ('.$dcname.':'.$dcdom.')';
             }
-            $table .= '</label></span></td>';
+            $table .= '</label></span></div>';
         }
-        $table .= '</tr></table>';
+        $table .= '</div></div></fieldset>';
     } elsif ($numdcs == 1) {
         my ($dcname,$dcdom) = split(':',$domcoord[0]);
         my $user = &Apache::loncommon::plainname($dcname,$dcdom);


More information about the LON-CAPA-cvs mailing list