[LON-CAPA-cvs] cvs: rat / lonwrapper.pm

raeburn raeburn at source.lon-capa.org
Sat Jun 27 15:06:50 EDT 2026


raeburn		Sat Jun 27 19:06:50 2026 EDT

  Modified files:              
    /rat	lonwrapper.pm 
  Log:
  - WCAG 2 compliance: title attribute for iframes to support screenreaders.
  
  
Index: rat/lonwrapper.pm
diff -u rat/lonwrapper.pm:1.89 rat/lonwrapper.pm:1.90
--- rat/lonwrapper.pm:1.89	Fri Dec 19 21:28:37 2025
+++ rat/lonwrapper.pm	Sat Jun 27 19:06:50 2026
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Wrapper for external and binary files as standalone resources
 #
-# $Id: lonwrapper.pm,v 1.89 2025/12/19 21:28:37 raeburn Exp $
+# $Id: lonwrapper.pm,v 1.90 2026/06/27 19:06:50 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -298,8 +298,18 @@
                 $output .= &create_link($url,$anchor,$title,$linktext);
             } else {
                 my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
+                my $frame;
+                if ($is_ext) {
+                    $frame = 'externalresource';
+                } elsif ($is_pdf) {
+                    $frame = 'pdf';
+                } elsif ($exttool) {
+                    $frame = 'externaltool';
+                } else {
+                    $frame = 'resource';
+                }
                 $output .= '<div style="overflow:scroll; -webkit-overflow-scrolling:touch;">'."\n".
-                           '<iframe src="'.$dest.'" height="100%" width="100%" frameborder="0">'."\n".
+                           '<iframe src="'.$dest.'" height="100%" width="100%" frameborder="0" title="'.$frame.'">'."\n".
                            "$lt{'noif'} $noiframe\n".
                            "</iframe>\n".
                            "</div>\n";
@@ -314,11 +324,21 @@
         # javascript will position the iframe if window was resized (or zoomed)
         my $script = &Apache::loncommon::iframe_wrapper_resizejs();
         my $dest = &HTML::Entities::encode($url.$anchor,'&<>"');
+        my $frame;
+        if ($is_ext) {
+            $frame = 'externalresource';
+        } elsif ($is_pdf) {
+            $frame = 'pdf';
+        } elsif ($exttool) {
+            $frame = 'externaltool';
+        } else {
+            $frame = 'resource';
+        }
         return <<ENDFRAME;
         $startpage
         $script
         <div class="LC_iframecontainer" role="main" id="LC_main_content">
-            <iframe src="$dest">$lt{'noif'} $noiframe</iframe>
+            <iframe src="$dest" title="$frame">$lt{'noif'} $noiframe</iframe>
         </div>
         $endpage
 ENDFRAME




More information about the LON-CAPA-cvs mailing list