|
| 1 | +# 5. Implement an accessible navigation system |
| 2 | + |
| 3 | +Date: 2024-03-22 |
| 4 | + |
| 5 | +## Status |
| 6 | + |
| 7 | +Accepted |
| 8 | + |
| 9 | +## Context |
| 10 | + |
| 11 | +Our initial releases of this theme used the [SmartMenus](https://www.smartmenus.org/) library to build its |
| 12 | +navigation menus. While this library is easy to implement and pretty useful, its |
| 13 | +output was flagged during usability and accessibility testing as needing some |
| 14 | +improvements. |
| 15 | + |
| 16 | +The markup which the user finally interacts with looks like this: |
| 17 | + |
| 18 | +```html |
| 19 | +<nav aria-label="Under the Lens: Women Biologists and Chemists at MIT (1865-2024)"> |
| 20 | + <ul class="navigation sm sm-mint" data-smartmenus-id="17111193231069111"> |
| 21 | + ... |
| 22 | + <li> |
| 23 | + <a href="/s/under-the-lens/page/timeline" class="has-submenu" id="sm-17111193231069111-1" aria-haspopup="true" aria-controls="sm-17111193231069111-2" aria-expanded="false">Timeline |
| 24 | + <span class="sub-arrow"></span> |
| 25 | + </a> |
| 26 | + <ul id="sm-17111193231069111-2" role="group" aria-hidden="true" aria-labelledby="sm-17111193231069111-1" aria-expanded="false" style="width: auto; min-width: 10em; display: none; max-width: 20em; top: auto; left: 0px; margin-left: 0px; margin-top: 0px;" class="sm-nowrap"> |
| 27 | + <li> |
| 28 | + <a href="/s/under-the-lens/page/timeline1">Timeline: The Beginnings</a> |
| 29 | + </li> |
| 30 | + ... |
| 31 | + </ul> |
| 32 | + </li> |
| 33 | + ... |
| 34 | + </ul> |
| 35 | +</nav> |
| 36 | +``` |
| 37 | + |
| 38 | +The issue is that the element triggering the flyout menu (the |
| 39 | +`<span class="sub-arrow"></span>` tag) is inside the anchor element, making it |
| 40 | +challenging for users of assistive technologies to separate their interactions |
| 41 | +with the menu link and the submenu toggle. |
| 42 | + |
| 43 | +The current release of SmartMenus (1.2.1) does not support placing this toggle |
| 44 | +element outside of the link element, so it will be necessary to replace it with |
| 45 | +a library which does support this behavior. |
| 46 | + |
| 47 | +### Option 1: SmartMenus 2 |
| 48 | + |
| 49 | +The maintainer for SmartMenus is aware of this problem in the library, as we and |
| 50 | +others have reported it via GitHub (see [issue 204](https://github.com/vadikom/smartmenus/issues/204) and [issue 231](https://github.com/vadikom/smartmenus/issues/231)). He has |
| 51 | +committed to including this as an improvement in the future release of |
| 52 | +SmartMenus 2, and the documentation already available [includes this among its available |
| 53 | +features](https://configurator.smartmenus.org/). |
| 54 | + |
| 55 | +However, at the time of writing [SmartMenus 2 is only available via one alpha |
| 56 | +release](https://github.com/vadikom/smartmenus/releases) - and the maintainer has [cautioned us against using it in a production |
| 57 | +system yet](https://github.com/vadikom/smartmenus/issues/245). |
| 58 | + |
| 59 | +* Pros: Just upgrading our existing menu library as it improves over time is a |
| 60 | + good philosophy to follow. |
| 61 | + |
| 62 | +* Cons: The timeline for the release of SmartMenus 2 is not clear, and so |
| 63 | + cannot be guaranteed to happen. Additionally, the significant changes to the |
| 64 | + library with version 2 will likely require a significant level of effort - so |
| 65 | + the benefits of a simple upgrade are not likely to accrue based on the |
| 66 | + materials published so far. |
| 67 | + |
| 68 | +### Option 2: Accessible Menu |
| 69 | + |
| 70 | +One alternative to SmartMenus is the Accessible Menu library, which takes as its |
| 71 | +starting point the ARIA Authoring Practices Guide for navigation menus. One of |
| 72 | +the supported patterns is the Disclosure Navigation Menu with Top-Level Links, |
| 73 | +which includes the needed separation between navigation links and submenu |
| 74 | +toggles. |
| 75 | + |
| 76 | +While the provided example includes this separation only at the top level of the |
| 77 | +menu, the pattern can be extended to all levels - as demonstrated in this |
| 78 | +CodePen. |
| 79 | + |
| 80 | +#### Benefits of Accessible Menu |
| 81 | + |
| 82 | +This menu, when properly configured, appears to implement all the best practices |
| 83 | +for an accessible navigation menu for web application. |
| 84 | + |
| 85 | +#### Drawbacks |
| 86 | + |
| 87 | +There are several significant drawbacks to using this menu library. |
| 88 | + |
| 89 | +* The most significant drawback is that it imposes some operating costs on users |
| 90 | + of assistive technology that are not ideal. Our recent accessibility testing |
| 91 | + included some details about this problem while we discussed this menu issue. |
| 92 | + |
| 93 | +* The markup requirements for this library do not immediately align with the |
| 94 | + markup generated by Omeka. This is manageable by either maintaining a set of |
| 95 | + custom navigation templates or by writing some javascript to manipulate the |
| 96 | + DOM prior to instantiating the menu. |
| 97 | + |
| 98 | +* The library is javascript-only, and is not distributed with any CSS rules. |
| 99 | + While we can develop and maintain these rules ourselves, it makes this library |
| 100 | + less of a turnkey solution. |
| 101 | + |
| 102 | +### Option 3: CSS-only menu libraries |
| 103 | + |
| 104 | +A third option would be to pursue a "pure CSS" navigation menu, which can be |
| 105 | +found described in several articles around the web. |
| 106 | + |
| 107 | +* Pros: A navigation menu which uses only CSS styles is technically much |
| 108 | + simpler, lacking the javascript that would need to be maintained (either by |
| 109 | + ourselves or by a dependency maintainer). |
| 110 | + |
| 111 | +* Cons: These types of navigation systems are likely not going to be fully |
| 112 | + accessible. There are elements of the WCAG standards which cannot be satisfied |
| 113 | + by stylesheets alone. An example is WCAG 1.4.13, which requires that revealed |
| 114 | + content like a submenu must be dismissable without changing the focus on a |
| 115 | + page. |
| 116 | + |
| 117 | +### Option 4: A bespoke solution |
| 118 | + |
| 119 | +While attempting to implement the Accessible Menu library, we asked for feedback |
| 120 | +about our progress from Rich Caloggero, who was involved in our earlier |
| 121 | +accessibility testing. Rich helpfully assembled a mockup demonstrating a usable |
| 122 | +navigation system with very little javascript (and no stylesheets). |
| 123 | + |
| 124 | +* Pros: This section needs to be filled out. |
| 125 | + |
| 126 | +* Cons: We will be responsible for maintaining the entirety of this solution, |
| 127 | + and will need to preserve the bandwidth and skills to fulfill this |
| 128 | + responsibility. |
| 129 | + |
| 130 | +## Decision |
| 131 | + |
| 132 | +We will develop, and maintain, a small set of javascript and stylesheet rules |
| 133 | +for the navigation menu in this theme. |
| 134 | + |
| 135 | +If this proves sustainable, the feature will be considered for promotion to the |
| 136 | +overall style library in order to make the feature available to our other |
| 137 | +web applications. |
| 138 | + |
| 139 | +## Consequences |
| 140 | + |
| 141 | +This section needs to be filled out. |
0 commit comments