Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miscellaneous a11y improvements #137

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Commits on Sep 5, 2024

  1. miscellaneous a11y improvements

    - set role="application" on toolbar and sidebar to force
    screen readers to use focus mode in those areas since
    reading mode is not applicable here and one should not have
    to manually switch to focus mode
    - made outline values visible to screen readers
    - improved aria-live message announced during search navigation
    to include the page number as well as the snippet of the
    result
    - added role="navigation" to start containers of epub ranges
    so that screen readers indicate when one moves to a new page.
    It also enabled navigation via d/shift-d for NVDA and r/shift-r
    for JAWS to go to next/previous page as with PDFs.
    - added a state variable a11yVirtualCursorTarget to record
    which node the screen readers should place its virtual cursor
    on next time the focus enters the reader.
    It forces virtual cursor to be moved onto that node, as
    opposed to landing in the beginning of the document.
    It is currently used to make sure screen readers begin reading
    the chapter/section selected in the outline, as well as to
    place virtual cursor on the last search result. On scroll,
    a11yVirtualCursorTarget is cleared to not interfere with
    mouse navigation. To make sure that scroll events of document
    that fire when outline is navigated don't clear the a11yVirtualCursorTarget
    that was just set, we wait for scrolling to finish and do
    not allow a11yVirtualCursorTarget to be cleared if it was added
    within the last 0.5 second.
    abaevbog committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    6d411f1 View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2024

  1. move virtual cursor when page is set in toolbar

    So that screen reader users land on the right page
    after changing the page number in the input or via
    buttons next to it. Once the input is changed,
    Escape keypress re-focuses the reader and it will
    focus an element at the top of the page for virtual
    cursor to move.
    abaevbog committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    8ae1105 View commit details
    Browse the repository at this point in the history
  2. move virtualCursor handling into views

    Except for placeA11yVirtualCursor which has the logic
    shared by all view types but it now fetches the node to
    focus from the view.
    abaevbog committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    e8f1a15 View commit details
    Browse the repository at this point in the history
  3. record top page to focus in _updateViewStats

    - Update the target node to focus for in _updateViewStats
    which triggers on every view scroll update. It allows
    us to have one place where we record which page to
    refocus, as opposed to doing it for every navigation
    method
    - To make sure our updates don't run too often and
    are not cleared by the scroll listener right after
    they are set, a11yWillPlaceVirtCursorOnTop runs
    through a debounce which will set the node when
    view updates are all finished.
    - Removed timestamp of what the target was recorded
    since it's irrelevant now
    - Instead, added allowUpdates variable which will
    not allow the node of _a11yVirtualCursorTarget to be
    updated. It is needed for search results to not get
    overriden by the a11yWillPlaceVirtCursorOnTop when
    scrolling is done
    abaevbog committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    577a916 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2024

  1. don't alter aria-label of the page

    Have pdfjs handle it
    abaevbog committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    a4af150 View commit details
    Browse the repository at this point in the history

Commits on Sep 11, 2024

  1. move placeA11yVirtualCursor into utilities.js

    So that views can share it without keeping it in
    the reader.js.
    
    Also, clear the virtual cursor target on mousedown
    instead of during scroll - it also fixes the issue of
    focus jumping to focused element on click after
    scroll after an outline entry is selected. But it
    also allows us to avoid multiple processes fighting
    to set or clear virtual cursor and reduce debounce timeout
    as a result.
    abaevbog committed Sep 11, 2024
    Configuration menu
    Copy the full SHA
    9ad399f View commit details
    Browse the repository at this point in the history

Commits on Sep 12, 2024

  1. move a11y search message handling to reader.js

    General refactoring to handle search result announcements
    from top-level Reader. a11yAnnounceSearchMessage
    adds readers currentSnippet and currentPageLabel from
    findState result if provided. Those don't exist for pdfs yet.
    
    Added currentSnippet and currentPageLabel to be included
    in epub and snapshot search results, so those are announced.
    
    More refactoring to avoid different event handlers fighting
    over who gets to set _a11yVirtualCursorTarget. It will
    just not be set by the navigation handler during search mode,
    which allows us to remove extraneous .allowUpdates field.
    
    Removed a11yHandleSearchResultUpdate from all views since
    messages are handler in Reader and curtorTargets can now be just
    set directly in findNext/findPrevious.
    
    Added a11yWillPlaceVirtCursorOnSearchResult specifically for pdf-view
    to update virtual cursor target, since findNext does not fire on
    first result, so we call a11yWillPlaceVirtCursorOnSearchResult
    when findState is updated.
    abaevbog committed Sep 12, 2024
    Configuration menu
    Copy the full SHA
    cadc0ee View commit details
    Browse the repository at this point in the history

Commits on Sep 16, 2024

  1. remove setA11yNavContent

    Set aria-label on epub paragraphs directly
    abaevbog committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    f28c24c View commit details
    Browse the repository at this point in the history
  2. expose getLocalizeString to views

    And use it to get localized page label for epub
    abaevbog committed Sep 16, 2024
    Configuration menu
    Copy the full SHA
    2bd6260 View commit details
    Browse the repository at this point in the history