Skip to content

Commit 47e03f6

Browse files
committed
Add skip links for accessibility
Why these changes are being introduced: This application has many focusable elements, and it may be helpful to users of assistive technology to provide skip links to different sections. Relevant ticket(s): * [GDT-161](https://mitlibraries.atlassian.net/browse/GDT-161) How this addresses that need: This adds the following skip links: * All views: nav, search form * Results: results list, filter sidebar * Record: record metadata Side effects of this change: * Some IDs have been added to top-level elements to make them selectable. * While working on this, I realized that VoiceOver doesn't recognize the filter labels as disclosure triangles, so even when they are closed, it tabs through every available filter. I've fixed this in a subsequent commit.
1 parent 72d42b3 commit 47e03f6

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

app/views/layouts/_site_nav.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div class="wrap-outer-header-local layout-band">
22
<div class="wrap-header-local">
33
<div class="wrap-local-nav">
4-
<nav class="local-nav" aria-label="Main menu">
4+
<nav class="local-nav" id="main-menu" aria-label="Main menu">
55
<%= nav_link_to("Home", root_path) %>
66
<% if Flipflop.enabled?(:gdt) %>
77
<div class="wrap-gis-links">

app/views/layouts/application.html.erb

+11-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
<%= render partial: "layouts/head" %>
55
</head>
66
<body class="app-theme">
7-
<a id="skip" class="skip sr sr-focusable" href="#content-main">Skip to main content</a>
7+
<a class="skip sr sr-focusable" href="#main-menu">Skip to main menu</a>
8+
<a class="skip sr sr-focusable" href="#basic-search">Skip to search form</a>
9+
<% if current_page?(results_path) %>
10+
<a class="skip sr sr-focusable" href="#results">Skip to results</a>
11+
<% if @filters.present? %>
12+
<a class="skip sr sr-focusable" href="#filters">Skip to search filters</a>
13+
<% end %>
14+
<% end %>
15+
<% if controller.controller_name == 'record' && controller.action_name == 'view' %>
16+
<a class="skip sr sr-focusable" href="#full-record">Skip to metadata</a>
17+
<% end %>
818

919
<div class="wrap-page">
1020

app/views/record/_record.html.erb

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
<div class="gridband layout-3q1q wrap-full-record">
1+
<div id="full-record" class="gridband layout-3q1q wrap-full-record">
22
<div class="col3q box-content region full-record" data-region="Full record">
3-
43
<h2 class="record-title">
54
<span class="sr">Title: </span>
65
<% if @record['title'].present? %>

app/views/record/_record_geo.html.erb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<div class="gridband layout-3q1q wrap-full-record">
1+
<div id="full-record" class="gridband layout-3q1q wrap-full-record">
22
<div class="col3q box-content region full-record" data-region="Full record">
33
<h2 class="record-title">
44
<span class="sr">Title: </span>

0 commit comments

Comments
 (0)