Navigation / Bypass blocks

URL: /
Criterion: 2.4.1 Bypass Blocks (A)

Users that wish to navigate through the page sequentially either using a keyboard or some other mean will sometimes want/need to skip the blocks of content that repeat on every page (e.g., headers, language selectors, etc.).

Normally, a bypass blocks link is added to the page such that it is revealed only on keyboard focus or to screen readers and similar accessibility technology. Here are some examples of this mechanism:

image

I intend to add a bypass block link that points to a element that has an id of main-content. This will allow us to mark an arbitrary element on the page as the bypass block link target depending on the content.

Thinking back about this issue, I see two options now:

  1. Add bypass block link (BBL) to all pages and expect pages to specify an appropriate target.
  2. Add a blank BBL container to the base template, and a partial to render the BBL. Expect the page to add the BBL individually.

The advantage of (1) is that we ensure BBL is always present… but… that’s not very useful if there’s no target. The second approach has a higher chance of having a valid target on the page, even though there won’t be a BBL on every page (until all pages are modified).

I think the second approach makes more sense in general so I will proceed that way.

The second approach will likely not work with the current template setup. The bypass link block needs to be at the top of the <body>, but the module templates are unable to overload blocks in the base template.

One thing I can think of right now is to add some client-side code to remove the bypass link if it does not point to an existing element. I am not too happy about this, but anything else I can think of probably just makes the server-side code more complex than it needs to.

Another thing that we can do is provide separate methods to render the module-specific pages using the built-in template inheritance logic rather than the current custom abstraction, with a long-term goal of migrating all modules to the new setup. This, however, feels a bit heavy-handed, and not quite sure CERN will be able to commit to such a big change. So probably not something I’d go into right now.