Accessibility in Syncfusion PDF Viewer component

The PDF Viewer component adheres to accessibility guidelines and standards, including ADA, Section 508, and WCAG 2.2. It also integrates WCAG roles commonly used for accessibility evaluation.

Below is an outline of the accessibility compliance for the PDF Viewer component:

Accessibility Criteria Compatibility
WCAG 2.2 Support Yes
Section 508 Support Yes
Screen Reader Support Yes
Right-To-Left Support Yes
Color Contrast Yes
Mobile Device Support Intermediate
Keyboard Navigation Support Yes
Accessibility Checker Validation Yes
Axe-core Accessibility Validation Yes
Yes - All features of the component meet the requirement.
Intermediate - Some features of the component do not meet the requirement.
No - The component does not meet the requirement.

WAI-ARIA attributes

WAI-ARIA (Web Accessibility Initiative – Accessible Rich Internet Applications) defines a way to make web content and web applications more accessible. It provides additional semantics to describe the role, state, and functionality of web components. The following ARIA attributes are used in the PDF Viewer component:

Attributes Purpose
aria-disabled Indicates whether the PDF Viewer component is in a disabled state.
aria-expanded Indicates whether the suggestion list has expanded.
aria-readonly Indicates the read-only state of the PDF Viewer element.
aria-haspopup Indicates whether the PDF Viewer input element has a suggestion list.
aria-label Provides a label for the breadcrumb item.
aria-labelledby Provides a label for the PDF Viewer, typically pointing to the ID of the element used as the viewer’s title.
aria-describedby This attribute points to an element describing the PDF Viewer component.
aria-orientation Indicates whether the PDF Viewer element is oriented horizontally or vertically.
aria-valuetext Returns the current text value of the PDF Viewer.
aria-valuemax Indicates the maximum value of the PDF Viewer.
aria-valuemin Indicates the minimum value of the PDF Viewer.
aria-valuenow Indicates the current value of the PDF Viewer.
aria-controls Attribute set on a button, pointing to its corresponding content.

Keyboard interaction

The PDF Viewer component follows the keyboard interaction guidelines, making it easy for users of assistive technologies (AT) and those who rely solely on keyboard navigation. The following keyboard shortcuts are supported by the PDF Viewer component:

Press (Windows) Press (Macintosh) To do this
    Shortcuts for page navigation
CONTROL + Left Arrow (or) CONTROL + Up Arrow COMMAND + Left Arrow (or) COMMAND + Up Arrow Navigate to the first page
CONTROL + Right Arrow (or) CONTROL + Down Arrow COMMAND + Right Arrow (or) COMMAND + Down Arrow Navigate to the last page
Left Arrow Left Arrow (or) Shift + Space Navigate to the previous page
Right Arrow Right Arrow (or) Space Navigate to the next page
CONTROL + G COMMAND + G Go to a specific page
Up Arrow Up Arrow Scroll up
Down Arrow Down Arrow Scroll down
    Shortcuts for zooming
CONTROL + = COMMAND + = Perform zoom-in operation
CONTROL + - COMMAND + - Perform zoom-out operation
CONTROL + 0 COMMAND + 0 Reset zoom level to 100%
    Shortcut for text search
CONTROL + F COMMAND + F Open the search toolbar
    Shortcut for text selection
CONTROL + C CONTROL + C Copy selected text, annotation, or form field
CONTROL + X CONTROL + X Cut selected text, annotation, or form field
CONTROL + V COMMAND + V Paste selected text, annotation, or form field
    Shortcuts for general operations
CONTROL + Z COMMAND + Z Undo the action
CONTROL + Y COMMAND + Y Redo the action
CONTROL + P COMMAND + P Print the document
Delete Delete Delete selected annotations and form fields
CONTROL + Shift + A COMMAND + Shift + A Toggle Annotation Toolbar
CONTROL + Alt + 0 COMMAND + Option + 0 Show Command panel
CONTROL + Alt + 2 COMMAND + Option + 2 Show Bookmarks
CONTROL + Alt + 1 COMMAND + Option + 1 Show Thumbnails
CONTROL + S COMMAND + S Download the document
Shift + H Shift + H Enable pan mode
Shift + V Shift + V Enable text selection mode

The current implementation of our PDF Viewer includes keyboard shortcuts for functions such as scrolling, zooming, text search, printing, and annotation deletion.

To enhance user experience, we are adding additional keyboard shortcuts for actions like navigating between pages, accessing specific pages, toggling annotation tools, and displaying PDF elements (outlines, annotations, bookmarks, and thumbnails).

To support these enhancements, we are introducing a new class called commandManager. This class handles custom commands triggered by specific key gestures, which are defined by users and executed accordingly.

The commandManager includes a parameter called keyboardCommand (which replaces Commands). This parameter holds a collection of custom keyboard commands specified by users. Each custom command is represented by a KeyboardCommand class, containing the name of the command and its associated gesture (keyboard combination).

Additionally, we are introducing an EventCallback to the keyboardCustomCommands parameter for the CommandManager. This will handle keyboard events and trigger appropriate methods when specific key combinations are pressed.

<div style="width:100%;height:600px">
    <ejs-pdfviewer id="pdfviewer"
                   documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
                   commandManager="commandManager">
    </ejs-pdfviewer>
</div>

<script type="text/javascript">

    function commandManager() {
       keyboardCommand: [{
            name: 'customCopy',
            gesture: {
                pdfKeys: PdfKeys.G,
                modifierKeys: ModifierKeys.Shift | ModifierKeys.Alt
               }
            },
            {
            name: 'customPaste',
            gesture: {
                pdfKeys: PdfKeys.H,
                modifierKeys: ModifierKeys.Shift | ModifierKeys.Alt
               }
            },
            {
            name: 'customCut',
            gesture: {
                pdfKeys: PdfKeys.Z,
                modifierKeys: ModifierKeys.Control
               }
            },
            {
            name: 'customSelectAll',
            gesture: {
                pdfKeys: PdfKeys.E,
                modifierKeys: ModifierKeys.Control
               }
            },
        ]
    }
</script>
<div style="width:100%;height:600px">
    <ejs-pdfviewer id="pdfviewer"
                   serviceUrl='/Index'
                   documentPath="https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf"
                   commandManager="commandManager">
    </ejs-pdfviewer>
</div>

<script type="text/javascript">
    function commandManager() {
       keyboardCommand: [{
            name: 'customCopy',
            gesture: {
                pdfKeys: PdfKeys.G,
                modifierKeys: ModifierKeys.Shift | ModifierKeys.Alt
               }
            },
            {
            name: 'customPaste',
            gesture: {
                pdfKeys: PdfKeys.H,
                modifierKeys: ModifierKeys.Shift | ModifierKeys.Alt
               }
            },
            {
            name: 'customCut',
            gesture: {
                pdfKeys: PdfKeys.Z,
                modifierKeys: ModifierKeys.Control
               }
            },
            {
            name: 'customSelectAll',
            gesture: {
                pdfKeys: PdfKeys.E,
                modifierKeys: ModifierKeys.Control
               }
            },
        ]
    }
</script>

Each keyboardCommand object consists of a name property, specifying the name of the custom command, and a gesture property, defining the key gesture associated with the command.

For example, the first command named customCopy is associated with the G key and requires both the Shift and Alt modifier keys to be pressed simultaneously.

Additionally, there’s an explanation of the key modifiers used in the gestures:

  • Ctrl corresponds to the Control key, represented by the value 1.
  • Alt corresponds to the Alt key, represented by the value 2.
  • Shift corresponds to the Shift key, represented by the value 4.
  • Meta corresponds to the Command key on macOS or the Windows key on Windows, represented by the value 8.

This setup allows users to perform custom actions within the PDF viewer by pressing specific key combinations, enhancing the user experience and providing more efficient navigation and interaction options.

Ensuring accessibility

The PDF Viewer component’s accessibility levels are ensured through an accessibility-checker and axe-core software tools during automated testing.

NOTE

Follow the steps provided in the link to create a simple PDF Viewer sample.