• Luciano Pacheco's avatar
    Fix a11y on navigation/directory tree · e410a714
    Luciano Pacheco authored
    This CL fixes the keyboard navigation when using screen reader/
    Chromevox.
    
    The main fix is to force focus on the cr.ui.Tree/DirectoryTree element
    when navigating with Chromevox keyboard shortcut "Search+right arrow",
    before the focus was staying on "body" element so Tree couldn't handle
    the keyboard events to expand/collapse directories.
    
    It's a series of small fixes.
    
    1. Fix text read by Chromevox when navigating on directories, it was
    reading all sub-directories names, instead of only the current focused
    directory's name, fixed by adding |id| to each entries' label element,
    to make existing |aria-labelledby| attribute work for screen reader.
    This was broken because we overwrite the |innerHTML| from
    |cr.ui.TreeItem|, losing the |id|.
    
    2. Listen to |click| event on DirectoryTree and forces the focus to it
    when the focus/activeElement is the "body" element. This happens when
    Chromevox issues the |click| event when user press "Search+right arrow".
    
    3. Replace |cr.ui.Tree|'s |role| attribute from "group" to "navigation",
    which is a "landmark" type which is recommended [1]. This required to
    change |cr.ui.Tree| to not overwrite existing |role| attribute.
    
    
    [1] - https://developers.google.com/web/fundamentals/accessibility/how-to-review#take_advantage_of_headings_and_landmarks
    
    Bug: 755278
    Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
    Change-Id: If33be610e1d28f0a69205ee148783328a367fe80
    Reviewed-on: https://chromium-review.googlesource.com/985772
    Commit-Queue: Luciano Pacheco (SYD) <lucmult@chromium.org>
    Reviewed-by: default avatarNaoki Fukino <fukino@chromium.org>
    Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
    Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
    Reviewed-by: default avatarSasha Morrissey <sashab@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#553917}
    e410a714
transfer.js 5.55 KB