[LON-CAPA-cvs] cvs: loncom /interface lonsimplepage.pm

raeburn raeburn at source.lon-capa.org
Sun Jan 4 21:44:32 EST 2026


raeburn		Mon Jan  5 02:44:32 2026 EDT

  Modified files:              
    /loncom/interface	lonsimplepage.pm 
  Log:
  - WCAG compliance
    - Include landmark for page's main content to support "Skip to main content"
    - <h1> heading not included for title if no title available
    - Include label for form element
  
  
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.108 loncom/interface/lonsimplepage.pm:1.109
--- loncom/interface/lonsimplepage.pm:1.108	Tue Jan 28 19:49:20 2025
+++ loncom/interface/lonsimplepage.pm	Mon Jan  5 02:44:32 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.108 2025/01/28 19:49:20 raeburn Exp $
+# $Id: lonsimplepage.pm,v 1.109 2026/01/05 02:44:32 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -181,6 +181,7 @@
                         'force_register' => $registered,
                        }); 
         $r->print($start_page);
+        $r->print('<div class="LC_landmark" role="main" id="LC_main_content">');
     }
 
     if ($group ne '') {
@@ -280,11 +281,16 @@
          (($group ne '' && ($group_home_view || $group_edit_perm ||
            $group_view_perm)) || ($group eq ''))) || ($allowed)) {
         #Print the title
-        my $titletext=&HTML::Entities::encode($syllabus{'aaa_title'},'<>&"');
+        my $title = $syllabus{'aaa_title'};
+        my $pagetitle = $title;
+        if (($allowed) && ($title eq '')) {
+            $pagetitle = &mt('No page title set');
+        }
+        my $titletext=&HTML::Entities::encode($pagetitle,'<>&"');
         if ($target ne 'tex') {
-            if ($allowed) {
+            if ($titletext ne '') {
+                $r->print('<h2 class="LC_heading_2">'.$titletext.'</h2>');
             }
-            $r->print('<h2>'.$titletext.'</h2>');
         } else {
             my $safeinit;
             $r->print(&Apache::lonxml::xmlparse($r,'tex','<h1>'.$titletext.'</h1>'));
@@ -295,7 +301,7 @@
                 $r->print('<form method="post" action="" enctype="multipart/form-data">'."\n".
                           '<input type="hidden" register="'.$registered.'" />');
 				&Apache::lontemplate::print_start_template($r,&mt('Title'),'LC_Box');
-				$r->print($titletext);
+				$r->print(&HTML::Entities::encode($title,'<>&"'));
 				$r->print("<br /><div>");
 				&Apache::lontemplate::print_textarea_template($r, $syllabus{'aaa_title'},
 					'aaa_title', $syllabusfields{'aaa_title'},
@@ -324,11 +330,12 @@
 
         if ($allowed) {
             &Apache::lontemplate::print_start_template($r, &mt('Upload a Photo'),'LC_Box');
+            my $labeltext = &mt('Choose photo file');
             $r->print($image);
             $r->print("<br /><br />");
             $r->print(
                 '<input type="hidden" name="forceedit" value="edit" />'.
-                '<input type="file" name="uploaddoc" size="50" />'.
+                '<input type="file" name="uploaddoc" size="50" aria-label="'.$labeltext.'" />'.
                 '<input type="submit" name="storeupl" value="'.&mt('Upload').'" />'.
                 '<input type="hidden" name="forceedit" value="edit" />');
             &Apache::lontemplate::print_end_template($r);




More information about the LON-CAPA-cvs mailing list