Skip to content

Commit a487391

Browse files
authored
fix: Resolve various WCAG accessibility / css issues in the HTML report (#7629)
1 parent e462a23 commit a487391

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

core/src/main/resources/templates/htmlReport.vsl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved.
2222

2323
#[[
2424
<!DOCTYPE html>
25-
<html>
25+
<html lang="en">
2626
<head>
2727
<title>Dependency-Check Report</title>
2828
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@@ -211,7 +211,14 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved.
211211
} else {
212212
dependenciesHeader.text(dependenciesHeaderAllText);
213213
}
214-
return toggleDisplay(event.target, '.notvulnerable', 'Showing Vulnerable Dependencies (click to show all)', 'Showing All Dependencies (click to show less)');
214+
const plainCaptionPart = $('#tablecaption-plain');
215+
const plainCaptionPartAllText = 'Summary of All Dependencies';
216+
if (plainCaptionPart.text() == plainCaptionPartAllText) {
217+
plainCaptionPart.text('Summary of Vulnerable Dependencies');
218+
} else {
219+
plainCaptionPart.text(plainCaptionPartAllText);
220+
}
221+
return toggleDisplay(event.target, '.notvulnerable', '(click to show all)', '(click to show less)');
215222
});
216223
$( ".versionToggle" ).bind( "click", function( event ) {
217224
var lnk = event.target;
@@ -230,7 +237,7 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved.
230237

231238

232239
</script>
233-
<style type="text/css">
240+
<style>
234241
#modal-background {
235242
display: none;
236243
position: fixed;
@@ -606,9 +613,6 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved.
606613
.notvulnerable {
607614
display:none;
608615
}
609-
.hidden {
610-
display:none;
611-
}
612616
.infolink {
613617
text-decoration:none;
614618
color: blue;
@@ -620,7 +624,7 @@ Copyright (c) 2012 Jeremy Long. All Rights Reserved.
620624
float:right;
621625
}
622626
.disclaimer {
623-
color: #888888;
627+
color: #595959;
624628
font: 9px "Droid Sans",Arial,"Helvetica Neue","Lucida Grande",sans-serif
625629
}
626630
.sortable {
@@ -756,9 +760,9 @@ Getting Help: <a href="https://github.com/dependency-check/DependencyCheck/issue
756760
<br/>
757761
#end
758762
<h2>Summary</h2>
759-
Display:&nbsp;<a href="#" title="Click to toggle display" id="vulnerabilityDisplayToggle">Showing Vulnerable Dependencies (click to show all)</a><br/><br/>
763+
<p><span id="tablecaption-plain">Summary of Vulnerable Dependencies </span><a href="#" title="Click to toggle display" id="vulnerabilityDisplayToggle">(click to show all)</a></p>
760764
#set($lnkcnt=0)
761-
<table id="summaryTable" class="lined">
765+
<table id="summaryTable" class="lined" aria-labelledby="tablecaption-plain">
762766
<thead><tr style="text-align:left">
763767
<th class="sortable" data-sort="string" title="The name of the dependency">Dependency</th>
764768
<th class="sortable" data-sort="string" title="The Common Platform Enumeration">Vulnerability&nbsp;IDs</th>

0 commit comments

Comments
 (0)