▾
The ArcGIS Maps SDK for JavaScript
Apps created with the JavaScript Maps SDK support keyboard navigation, alternative text, color contrast in dark and light themes, reduced motion preferences, semantic structure, and additional design and feature considerations. This enables developers to create apps that are accessible to a broader audience as they take advantage of these capabilities.
While JavaScript Maps SDK and Calcite Design System are created with accessibility in mind, there are additional steps you can take to ensure a diverse audience can navigate, understand, and use the solutions you build. For additional accessibility best practices, visit Accessibility - Calcite Design System.
Build an accessible UI
Making use of semantic HTML elements to communicate your application’s structure is one step you can take to ensure a diverse audience can use it.
For example, headers are a logical way for your audience to understand a page’s content hierarchy.
Each page should have one h1 and the headings must be ordered logically (h1 > h2 > h3).
Within the content of the page, use links for navigation, and buttons for actions, ensuring predictable behavior. Links must describe their destination, avoid words like “click here” or “learn more” without context.
For forms, label each form control. Mark required fields in code and connect each error message to its control.
For tables, add a caption to each.
Mark header cells with scope.
Make sure that touch targets are large enough and spaced well apart, and that the page works at 200% zoom without horizontal scrolling.
Keyboard navigation
Keyboard navigation is supported in both 2D and 3D.
- MapView navigation
- SceneView navigation
- Sketch widget point and keyboard gestures
- SketchViewModel point and keyboard gestures
- Draw point and keyboard gestures
Focus
Keyboard focus refers to an element receiving keyboard input. Exactly one element is able to have focus at a time. In most browsers, users can move focus by pressing the Tab key to step forward and the Shift and Tab keys to step back.
The JavaScript Maps SDK supports keyboard focus on the component’s interactive elements, such as buttons and input fields, providing a visual indicator showing which element is currently focused. A visible focus ensures more audiences, in particular individuals with low vision and cognitive disabilities, can perceive which element is receiving focus.
Focus trapping
The Popup component traps keyboard focus upon opening, returning focus to the element that opened it when it closes. While the popup is active, keyboard navigation is limited to its interactive elements residing within the component, preventing users from unintentionally moving focus elsewhere in the app. Focus trapping creates a more predictable navigation experience for more individuals. To disable focus trapping, set the Popup’s focusTrapDisabled property to true.
Charts
The Chart and Charts action bar components can be focused with the Tab key. Within a chart, use the Tab key to navigate and focus on data items. Charts with a large number of data items may not support Tab navigation.
For more information on keyboard navigation and accessibility, refer to Calcite Design System’s Accessibility guidance.
Assistive technologies
Assistive technologies, such as screen readers, serve as a tool for more users to gain access to content on the web. JavaScript Maps SDK offers accessibility support through ARIA attributes and ARIA live regions to provide similar experiences to more users, including individuals accessing the web through assistive technologies.
ARIA attributes
JavaScript Maps SDK offers ARIA attributes on the Map, Scene and Chart components, as well as on MapView and SceneView, through the aria property, which supports the following properties:
label– a concise accessible name for the view containerdescription– a more detailed accessible description of the view containerlabelledByElements– an array of HTML elements whose text are combined to provide the accessible name of the view containerdescribedByElements– an array of HTML elements whose text are combined to provide the accessible description of the view container
The view container for the Map or Scene has an ARIA role of application. This role indicates that the area provides a rich, interactive experience. It’s important for this element to have an accessible name — either through the label or labelledByElements property — so that screen reader users don’t only hear “application,” which provides little context. Including a description, or linking to one with describedByElements, can further help users understand the map’s purpose or content.
These attributes help make applications more inclusive by ensuring the view container is properly named and described for assistive technologies.
ARIA live announcements
ARIA live regions provide context to dynamic changes to announce what is changing visually to audiences using assistive technologies.
JavaScript Maps SDK offers support for live announcements with the Basemap Toggle, Bookmarks and Search components, where on selection the basemap’s title, bookmark’s name and search result are respectively announced to assistive technologies. The dynamic change provides context of the interaction using aria-live="polite" so assistive technologies are notified of the update with other settings taking precedence. The live announcements are offered with no additional configuration for developers or users.
Reduced motion
To accommodate users with vestibular motion disorders or individuals who prefer less animation in their applications, the prefers-reduced-motion media query is supported in 2D MapViews.
When users have enabled reduced motion or no animations in the operating system or browser, animations will be reduced in the following instances:
- During map navigation with MapView.goTo()
- When navigating the map via widgets such as Search and Bookmarks
- When panning the map, the momentum feature, which typically allows the MapView to continue slight movement after the mouse pointer has been lifted, will be disabled
Additionally, widgets and ArcGIS Maps SDK for JavaScript components built with Calcite Design System adapt to reduced motion by reducing the speed of certain animations, such as during widget loading.
Controlling animations with MapView and Map component
Developers can explicitly control animations in 2D views using:
- The
animationsEnabledproperty on MapView - The
animationsDisabledproperty on the Map component
These settings affect all animations in a 2D view, including symbols, renderers, layers, and navigation. They can be used in combination with the CSS prefers-reduced-motion media query to create accessible applications that respect users’ motion preferences.
Controlling animations with Chart component
By default, animations in charts are disabled. To enable animations, set the animationsEnabled property to true on the chart component.
This setting affects all animations when the chart is first rendered or when the chart’s configuration changes.
Implementing reduced motion in your applications
When designing apps with reduced motion in mind, consider the following guidelines:
- Provide the user the ability to control animations, for instance, by incorporating a play and pause button.
- If the animations do not enhance context or meaning, it is recommended to remove the animations.
- If the animation does contribute to the app’s context or meaning, aim to minimize the motion while still effectively conveying the message.
To determine if a user has enabled reduced motion on their operating system or browser, use the following code snippet to adjust your app’s animations accordingly:
const isReduced = window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;Font size
Font size can be beneficial to accommodate more audiences, where, when provided, larger text can account for additional devices, screen sizes, and viewing conditions. To ensure more individuals can access contents with larger text, components and widgets can be configured for more prominent font sizes using CSS variables:
/* Component and widget font size on smaller devices */@media (max-width: 767px) { arcgis-search, .esri-search { --calcite-font-size-relative-base: 16px; }}Color
When designing apps with color in mind, some considerations include:
- To showcase your data, you can switch between dark and light modes.
- Smaller fonts need larger contrast. For example, a contrast ratio of at least 4.5:1, while a larger text only need a contrast ratio of 3:1.
- Data-driven styles for visualization, Smart Mapping, checks if your basemap is dark or light colored.
- Default colors used in popup charts meet WCAG’s Success Criterion 1.4.3 for color contrast ratio in both light and dark themes. Symbology can be set with these colors by using the “Olympic Sunset” color ramp.
- Change the default view theme used by several widgets and tools.
Language
Set the page locale to help assistive technologies know how to read it:
<html lang="sv">
or dynamically:
document.documentElement.lang = "sv"; // Swedish
Localize the strings used by the Maps SDK in your app:
intl.setLocale("ja"); // Japanese
Resources
For additional accessibility best practices, visit Accessibility - Calcite Design System.
For more information about Esri’s commitment to accessible technology, visit Esri Accessibility. For legal information about accessibility, visit Esri Legal Accessibility.