7198273: RFE : Javadoc Accessibility : Hyperlinks should contain text or an image with alt text
Reviewed-by: jjg
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Fri Aug 30 15:14:51 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java Fri Aug 30 15:59:33 2013 -0700
@@ -502,16 +502,17 @@
if (!configuration.nonavbar) {
String allClassesId = "allclasses_";
HtmlTree navDiv = new HtmlTree(HtmlTag.DIV);
+ Content skipNavLinks = configuration.getResource("doclet.Skip_navigation_links");
if (header) {
body.addContent(HtmlConstants.START_OF_TOP_NAVBAR);
navDiv.addStyle(HtmlStyle.topNav);
allClassesId += "navbar_top";
Content a = getMarkerAnchor("navbar_top");
+ //WCAG - Hyperlinks should contain text or an image with alt text - for AT tools
navDiv.addContent(a);
- Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_top"),
- HtmlTree.EMPTY,
- configuration.getText("doclet.Skip_navigation_links"),
- "");
+ Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
+ DocLink.fragment("skip-navbar_top"), skipNavLinks,
+ skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
} else {
body.addContent(HtmlConstants.START_OF_BOTTOM_NAVBAR);
@@ -519,10 +520,9 @@
allClassesId += "navbar_bottom";
Content a = getMarkerAnchor("navbar_bottom");
navDiv.addContent(a);
- Content skipLinkContent = getHyperLink(DocLink.fragment("skip-navbar_bottom"),
- HtmlTree.EMPTY,
- configuration.getText("doclet.Skip_navigation_links"),
- "");
+ Content skipLinkContent = HtmlTree.DIV(HtmlStyle.skipNav, getHyperLink(
+ DocLink.fragment("skip-navbar_bottom"), skipNavLinks,
+ skipNavLinks.toString(), ""));
navDiv.addContent(skipLinkContent);
}
if (header) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Fri Aug 30 15:14:51 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlStyle.java Fri Aug 30 15:59:33 2013 -0700
@@ -68,6 +68,7 @@
packageSummary,
rowColor,
serializedFormContainer,
+ skipNav,
sourceContainer,
sourceLineNo,
strong,
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Fri Aug 30 15:14:51 2013 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/stylesheet.css Fri Aug 30 15:59:33 2013 -0700
@@ -180,6 +180,12 @@
margin: auto 5px;
border:1px solid #c9aa44;
}
+.skipNav {
+ position:absolute;
+ top:auto;
+ left:-9999px;
+ overflow:hidden;
+ }
/*
Page header and footer styles
*/
--- a/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Fri Aug 30 15:14:51 2013 -0700
+++ b/langtools/test/com/sun/javadoc/AccessSkipNav/AccessSkipNav.java Fri Aug 30 15:59:33 2013 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 4638136
+ * @bug 4638136 7198273
* @summary Add ability to skip over nav bar for accessibility
* @author dkramer
* @run main AccessSkipNav
@@ -42,7 +42,7 @@
*/
public class AccessSkipNav {
- private static final String BUGID = "4638136";
+ private static final String BUGID = "4638136 - 7198273";
private static final String BUGNAME = "AccessSkipNav";
private static final String FS = System.getProperty("file.separator");
private static final String PS = System.getProperty("path.separator");
@@ -86,7 +86,7 @@
// Testing only for the presence of the <a href> and <a name>
// Top navbar <a href>
- { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a>",
+ { "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Top navbar <a name>
@@ -95,7 +95,7 @@
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <a href>
- { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\"></a>",
+ { "<a href=\"#skip-navbar_bottom\" title=\"Skip navigation links\">Skip navigation links</a>",
TMPDEST_DIR1 + "p1" + FS + "C1.html" },
// Bottom navbar <a name>
--- a/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Fri Aug 30 15:14:51 2013 -0700
+++ b/langtools/test/com/sun/javadoc/testNavigation/TestNavigation.java Fri Aug 30 15:59:33 2013 -0700
@@ -23,13 +23,12 @@
/*
* @test
- * @bug 4131628 4664607 7025314 8023700
+ * @bug 4131628 4664607 7025314 8023700 7198273
* @summary Make sure the Next/Prev Class links iterate through all types.
* Make sure the navagation is 2 columns, not 3.
* @author jamieh
* @library ../lib/
- * @build JavadocTester
- * @build TestNavigation
+ * @build JavadocTester TestNavigation
* @run main TestNavigation
*/
@@ -61,7 +60,7 @@
{BUG_ID + FS + "pkg" + FS + "I.html", "<li>Next Class</li>"},
// Test for 4664607
{BUG_ID + FS + "pkg" + FS + "I.html",
- "<a href=\"#skip-navbar_top\" title=\"Skip navigation links\"></a><a name=\"navbar_top_firstrow\">" + NL +
+ "<div class=\"skipNav\"><a href=\"#skip-navbar_top\" title=\"Skip navigation links\">Skip navigation links</a></div>" + NL + "<a name=\"navbar_top_firstrow\">" + NL +
"<!-- -->" + NL + "</a>"}
};
private static final String[][] NEGATED_TEST = NO_TEST;