Skip to content

Commit 09c0733

Browse files
brendanx67claude
andauthored
Added accessibility and docs support to tool listing page (#614)
* Added accessibility and docs support to tool listing page * Added visually-hidden tool name to Download and Documentation buttons * Show Documentation button when tool has docs extracted from ZIP * - Replaced <a><button> nesting with link() builder - Added display:inline-flex; and align-items:center; to styled-button CSS class for consistent appearance with <button> * Converted Download <button> to <a> using link() builder for consistency * Added a.styled-button CSS for text-decoration and visited color * Moved space into visually-hidden span as &nbsp; to prevent collapsing Co-Authored-By: Claude <noreply@anthropic.com>
1 parent a48fb58 commit 09c0733

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

SkylineToolsStore/src/org/labkey/skylinetoolsstore/view/SkylineToolsStoreWebPart.jsp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
.content {margin: 8px 12px 0 0; padding:0; text-align:justify;}
5959
.toolButtons {margin-top: 12px;}
6060
.styled-button{
61+
display:inline-flex;
62+
align-items:center;
6163
box-shadow:rgba(0,0,0,0.0.1) 0 1px 0 0;
6264
background-color:#5B74A8;
6365
border:1px solid #29447E;
@@ -72,6 +74,8 @@
7274
cursor:pointer;
7375
}
7476
.styled-button:hover{background-color:#1e90ff; color:#f5f5dc;}
77+
a.styled-button{text-decoration:none; color:#fff;}
78+
a.styled-button:visited{color:#fff;}
7579
.toolOwners {width: 80%; min-width: 300px;}
7680
.ui-menu {width:240px;}
7781
.dropMenu {position: absolute;}
@@ -153,6 +157,8 @@
153157
// Get supporting files in map <url, icon url>
154158
HashMap<String, String> suppFiles = SkylineToolsStoreController.getSupplementaryFiles(tool);
155159
Iterator suppIter = suppFiles.entrySet().iterator();
160+
boolean hasDocs = tool.hasDocumentation();
161+
int docCount = suppFiles.size() + (hasDocs ? 1 : 0);
156162
157163
final String curToolOwners = StringUtils.join(SkylineToolsStoreController.getToolOwners(tool), ", ");
158164
toolOwners.put(tool.getRowId(), curToolOwners);
@@ -200,17 +206,23 @@
200206

201207
<div class="toolButtons">
202208

203-
<button type="button" id="download-tool-btn-<%=tool.getRowId()%>" class="styled-button">Download <span class="visually-hidden"><%=h(tool.getName())%></span></button>
204-
<% addHandler("download-tool-btn-" + tool.getRowId(), "click", "window.location.href = " + q(urlFor(SkylineToolsStoreController.DownloadToolAction.class).addParameter("id", tool.getRowId()))); %>
209+
<%=link(unsafe("Download<span class=\"visually-hidden\">&nbsp;" + h(tool.getName()) + "</span>")).href(urlFor(SkylineToolsStoreController.DownloadToolAction.class).addParameter("id", tool.getRowId()).toString()).clearClasses().addClass("styled-button")%>
205210
<%
206-
if (suppFiles.size() == 1) {
211+
if (docCount == 1 && hasDocs) {
212+
%>
213+
<%=link(unsafe("Documentation<span class=\"visually-hidden\">&nbsp;" + h(tool.getName()) + "</span>")).href(tool.getDocsUrl()).clearClasses().addClass("styled-button").target("_blank").rel("noopener noreferrer")%>
214+
<%
215+
} else if (docCount == 1) {
207216
Map.Entry suppPair = (Map.Entry)suppIter.next();
208217
%>
209-
<a href="<%=h(suppPair.getKey())%>"><button type="button" class="styled-button">Documentation</button></a>
210-
<% } else if (suppFiles.size() > 1) { %>
218+
<%=link(unsafe("Documentation<span class=\"visually-hidden\">&nbsp;" + h(tool.getName()) + "</span>")).href(suppPair.getKey().toString()).clearClasses().addClass("styled-button")%>
219+
<% } else if (docCount > 1) { %>
211220
<div class="menuMouseArea">
212-
<button type="button" class="styled-button">Documentation</button>
221+
<button type="button" class="styled-button">Documentation<span class="visually-hidden"><%=h(tool.getName())%></span></button>
213222
<ul class="dropMenu">
223+
<% if (hasDocs) { %>
224+
<li><a href="<%=h(tool.getDocsUrl())%>" target="_blank" rel="noopener noreferrer"><img class="menuIconImg" src="<%= h(imgDir) %>link.png" alt="Documentation">Online Documentation</a></li>
225+
<% } %>
214226
<%
215227
while (suppIter.hasNext()) {
216228
Map.Entry suppPair = (Map.Entry)suppIter.next();

0 commit comments

Comments
 (0)