Page MenuHomePhabricator

wikimediafoundation.org does not offer other languages without JavaScript and lacks of a11y
Open, Needs TriagePublic

Description

The language selection approach at https://wikimediafoundation.org/ does not work without active JavaScript and is not well available to blind users.

Since HTML.4 in 1998 there is a well understood approach to offer options. This will be identified by screenreaders and does not require JavaScript.

The solution end of June / beginning of July 2019 makes the offers invisible and is relying on JavaScript to enable a choice.

  • I happen to block some JS for this page triggered by security issue.
  • The choice of language is a major issue for people. For those with visual limitations a clear advice is required that there is a top level page navigation provided. There is a button aria-label hint, but should be ranked as an important role (so-called landmark-role).

Current approach:

<div class="language-dropdown">
  <button aria-label="Select language">
    <span class="btn-label-a11y">Current language: </span>
    <img src="/wp-content/themes/shiro/assets/src/svg/language.svg" alt="" class="language-icon">
    <span>en</span>
    <img src="/wp-content/themes/shiro/assets/src/svg/down.svg" alt="" class="down-indicator">
  </button>
  <div class="language-list">
    <ul>
    <li><a class="selected" href="https://wikimediafoundation.org/">English</a></li>
    <li>...</li>
    <li><a href="https://wikimediafoundation.org/es/?noredirect=es_ES">Español</a></li>
    </ul>
  </div>
</div>

Easy first measure:

improved element attention
<div class="language-dropdown" role="navigation">

The key issues of a responsive solution might look like this:

noscript fallback and screenreader support
<div class="language-dropdown" role="navigation">
  <form action="/">
    <label>Select language
      <select name="uselang">
        <option value="en" selected>English</option>
        <option>...</option>
        <option value="es-ES">Español</option>
        etc.
      </select>
    </label>
  </form>
  <button style="display:none" aria-label="Select language" role="none presentation">
    <span class="btn-label-a11y">Current language:</span>
    <img src="/wp-content/themes/shiro/assets/src/svg/language.svg" alt="" class="language-icon">
    <span>en</span>
    <img src="/wp-content/themes/shiro/assets/src/svg/down.svg" alt="" class="down-indicator" role="none presentation">
  </button>
  <div class="language-list" style="display:none" role="none presentation">
    <ul>
    <li>...</li>
    </ul>
  </div>
</div>

That will adapt to the situation of the visitor.

  • By JavaScript the elements as currently used can be made visible, button will remove display:none from start and .language-list when button clicked (as currently performed). The attribute is given inline here for clarification and may be set by style sheet as current.
  • By JavaScript the form element may be assigned some smart CSS attributes in a way that it vanishes from visible space but is still part of the semantic structure. The latter is crucial for screenreaders which need to digest the options, but have no knowledge of optical appearance. The safest way would be to assign a position outside of a clipping frame.

The responsive result for the three constellations:

  • For screenreaders both current elements are kept inexistent due to role=none. form is in effect by semantic structure. It does not matter what JavaScript might have modified.
  • For non-JS both current elements are kept invisible since the button is never displayed. form is in place since it has not been moved outside clipping.
  • For visual JavaScript visitors the form is not present since out of clipping, and button is enabled.

Naturally, all elements in options and animation need to be equipped by appropriate language and RTL attribution when differing from page default.

This behaviour would be what I do expect from the starting page of an organisation which loudly claims to provide a lot of content for everybody around the world with respect to diversity and accessability. On the same page it can be read “more accessible worldwide” but WMF fails already on the starting page to match the own promise.

In favour of KISS (keep it simple and stupid) I would limit myself to 1998 technology and avoid FOUC. The current solution ranks nice fancy design higher than functionality.

Event Timeline

On the mobile version, the same problem affects the navigational menu (on desktop it's always shown).

image.png (568×320 px, 136 KB)

Alternative simple solution is to just use a <select> dropdown (like in the fallback described here), like on the https://www.wikipedia.org/ portal. But this is probably not adequate for the navigational menu.

For no-JS support while keeping the current design, you can make a menu that is toggled using an invisible checkbox. We used this approach in MediaWiki (Vector skin) for the "More" dropdown menu.

As a side note, the languages menu is duplicated within the site content. While this seems a bit weird to me, it does provide an accessible alternative to the normal menu.

image.png (980×1 px, 675 KB)

As a side note, the languages menu is duplicated within the site content. While this seems a bit weird to me, it does provide an accessible alternative to the normal menu.

Uhhpff. I did not find that, but I did not read the entire page with all details down to bottom and scrolled quickly. However, it is important that the opportunity is shown in prominent position and ARIA-marked for those who cannot see it. The blind Spanish visitors will appreciate that.

The footer-in-the-middle solution might be a non-JS alternative, but then some issues are left:

  • Headline gadget needs to disappear entirely in case of non-JS.
  • ARIA role is required anyway, since many screenreaders are processing first raw HTML and do not wait for funny visual things playing around, but rely on initial HTML contents.
  • Position of footer-in-the-middle doesn't matter since screenreader will collect any semantic role="navigation" wherever located.
  • A non-JS screenreader alternative can be emulated if attributed correctly with role="menubar" and role="menuitem" etc. applied to the static row.
  • Then the corner gadget should vanish by role="none presentation".
  • Since the corner gadget does need JS it should be FOUC-added actively by JS while invisible in non-JS. In this mode it does not bother anybody. Even more, the entire element can be added dynamically to the HTML document by jQuery, while the static bar is part of initial document.

I have tested the proposed solution, but without success. We are looking into this.

This has been under "Working on" for two one and a half years, any updates?