How can I help you?
Accessibility in Syncfusion JavaScript ES5 PDF Viewer components
13 Feb 202618 minutes to read
The PDF Viewer complies with widely adopted accessibility standards and guidance, including ADA, Section 508, WCAG 2.2, and WAI-ARIA roles. The following table summarizes the component’s accessibility coverage.
- All features of the component meet the requirement.
- Some features of the component do not meet the requirement.
- The component does not meet the requirement.Note: Mobile device support is marked as partial due to platform-level constraints on hover interactions, complex keyboard navigation, and screen reader capabilities that vary by device and browser.
WAI-ARIA attributes
WAI-ARIA (Accessible Rich Internet Applications) provides semantics that improve the accessibility of dynamic web content. The following ARIA attributes are used by the PDF Viewer to expose roles, states, and relationships to assistive technologies:
| Attributes | Purpose |
|---|---|
aria-disabled |
Indicates whether the PDF Viewer component is in a disabled state or not. |
aria-expanded |
Indicates whether an element within the PDF Viewer is expanded or collapsed. |
aria-readonly |
Indicates the read-only state of a PDF Viewer element. |
aria-haspopup |
Indicates the presence of a popup, such as a context menu or submenu. |
aria-label |
Provides a human-readable label for interactive elements in the PDF Viewer. |
aria-labelledby |
Identifies the element(s) that label the PDF Viewer, often referencing the title element. |
aria-describedby |
Identifies the element(s) that describe the PDF Viewer or its controls. |
aria-orientation |
Indicates whether an element is oriented horizontally or vertically. |
aria-valuetext |
Provides a human-readable text alternative for the current value of a range-type element. |
aria-valuemax |
Specifies the maximum value of a range-type element. |
aria-valuemin |
Specifies the minimum value of a range-type element. |
aria-valuenow |
Specifies the current value of a range-type element. |
aria-controls |
Identifies the element(s) controlled by the current element. |
Keyboard interaction
The PDF Viewer follows WAI-ARIA keyboard interaction recommendations to support users who rely on keyboard navigation and assistive technologies. The following keyboard shortcuts are supported.
| 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 | Retain the zoom level to 1 |
| Shortcut for Text Search | ||
| CONTROL + F | COMMAND + F | Open the search toolbar |
| Shortcut for Text Selection | ||
| CONTROL + C | CONTROL + C | Copy the selected text or annotation or form field |
| CONTROL + X | CONTROL + X | Cut the selected text or annotation of the form field |
| CONTROL + Y | CONTROL + Y | Paste the selected text or annotation or form field |
| Shortcuts for the general operation | ||
| CONTROL + Z | CONTROL + Z | Undo the action |
| CONTROL + Y | CONTROL + Y | Redo the action |
| CONTROL + P | COMMAND + P | Print the document |
| Delete | Delete | Delete the 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 |
| Shift + H | Shift + H | Enable pan mode |
| Shift + V | Shift + V | Enable text selection mode |
The PDF Viewer supports custom keyboard commands through a commandManager, which handles commands triggered by specific key gestures. Custom commands are defined by users and executed accordingly. The commandManager includes a keyboardCommand collection to hold custom keyboard commands. Each custom command is represented by a KeyboardCommand entry, containing the command name and associated keyboard combination. Additionally, the keyboardCustomCommands parameter utilizes an event callback to handle keyboard events and trigger methods when specific key combinations are pressed.
<html>
<head>
<!--Refer scripts and styles from CDN-->
<script
src="https://cdn.syncfusion.com/ej2/20.2.48/dist/ej2.min.js"
type="text/javascript">
</script>
<link
href="https://cdn.syncfusion.com/ej2/20.2.48/material.css"
rel="stylesheet"/>
<link
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
rel="stylesheet"/>
<style>
body {
touch-action: none;
}
</style>
</head>
<body>
<div class="control-section">
<div class="content-wrapper">
<!--Add the PDF Viewer-->
<div id="pdfViewer" style="height: 640px; width: 100%"></div>
</div>
</div>
<script>
var viewer = new ej.pdfviewer.PdfViewer({
//Sets the document path for initial loading
documentPath: 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',
resourceUrl: "https://cdn.syncfusion.com/ej2/31.2.2/dist/ej2-pdfviewer-lib"
});
//Inject the dependencies required to render the PDF Viewer
ej.pdfviewer.PdfViewer.Inject(
ej.pdfviewer.Toolbar, ej.pdfviewer.Magnification, ej.pdfviewer.BookmarkView, ej.pdfviewer.ThumbnailView,
ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation,
ej.pdfviewer.LinkAnnotation, ej.pdfviewer.Annotation, ej.pdfviewer.FormFields, ej.pdfviewer.FormDesigner
);
viewer.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
}
},
]
};
viewer.appendTo('#pdfViewer');
</script>
</body>
</html><html>
<head>
<!--Refer scripts and styles from CDN-->
<script
src="https://cdn.syncfusion.com/ej2/20.2.48/dist/ej2.min.js"
type="text/javascript">
</script>
<link
href="https://cdn.syncfusion.com/ej2/20.2.48/material.css"
rel="stylesheet"/>
<link
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
rel="stylesheet"/>
<style>
body {
touch-action: none;
}
</style>
</head>
<body>
<div class="control-section">
<div class="content-wrapper">
<!--Add the PDF Viewer-->
<div id="pdfViewer" style="height: 640px; width: 100%"></div>
</div>
</div>
<script>
var viewer = new ej.pdfviewer.PdfViewer({
//Sets the document path for initial loading
documentPath: 'https://cdn.syncfusion.com/content/pdf/pdf-succinctly.pdf',
serviceUrl:'https://document.syncfusion.com/web-services/pdf-viewer/api/pdfviewer',
});
//Inject the dependencies required to render the PDF Viewer
ej.pdfviewer.PdfViewer.Inject(
ej.pdfviewer.Toolbar, ej.pdfviewer.Magnification, ej.pdfviewer.BookmarkView, ej.pdfviewer.ThumbnailView,
ej.pdfviewer.TextSelection, ej.pdfviewer.TextSearch, ej.pdfviewer.Print, ej.pdfviewer.Navigation,
ej.pdfviewer.LinkAnnotation, ej.pdfviewer.Annotation, ej.pdfviewer.FormFields, ej.pdfviewer.FormDesigner
);
viewer.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>
</body>
</html>Each keyboardCommand object consists of a name property for the custom command and a gesture property defining the key gesture associated with the command. For example, the customCopy command is associated with the G key and requires both the Shift and Alt modifier keys to be pressed simultaneously.
Key modifiers used in gestures:
- Ctrl corresponds to the Control key (value
1). - Alt corresponds to the Alt key (value
2). - Shift corresponds to the Shift key (value
4). - Meta corresponds to the Command key on macOS or the Windows key on Windows (value
8).
This setup enables users to perform custom actions within the PDF Viewer by pressing specific key combinations, improving navigation and interaction efficiency.
Ensuring accessibility
The PDF Viewer component’s accessibility levels are ensured through an accessibility-checker and axe-core software tools during automated testing.