WhoBuilt

Building Accessibility Hooks for React Native & Web

Oct 18, 2021· 30 min· 1.5K views·Watch on YouTube

Speaker

Sanket Sahu, a software engineer at Geeks, explains how to build accessible interfaces for React Native and web at React Native EU 2021, presented by Callstack.

What accessibility requires

Sahu describes accessibility as making apps and websites usable by as many people as possible. He highlights screen reader support, readable contrast, responsive layouts, and keyboard navigation as key considerations.

Connect interface state to accessibility

Using a web checkbox, Sahu shows how React state can update both the visible control and its accessibility information. He demonstrates ARIA attributes such as `aria-checked` and `aria-labelledby`, and explains that a custom-styled `div` needs an appropriate checkbox role.

Build across web and mobile

Sahu demonstrates React Native accessibility props such as `accessible`, `accessibilityRole`, and `accessibilityState` with a checkbox. For a shared component, he suggests using a native checkbox input on web and React Native accessibility props on mobile, while reusing the same visual UI.

Use hooks to handle complex interactions

Sahu introduces React Aria and React Stately hooks that provide behavior and accessibility props without prescribing a visual design. React Native Aria extends that approach to React Native and web, with hooks for controls such as checkboxes, menus, sliders, and combo boxes. He shows how NativeBase uses these tools for cross-platform components.

Check accessibility beyond the component

Sahu calls out keyboard interaction, screen reader labels, and color contrast as areas that need attention, especially for custom combo boxes. He points to the A11Y Project checklist and describes WCAG levels A, AA, and AAA, including contrast examples of 4.5:1 for AA and 7:1 for AAA.

Takeaways

  • Keep interface state and accessibility state in sync so assistive technologies receive the same updates as the visual UI.
  • Prefer native HTML controls on the web when they already provide the required semantics and behavior.
  • For cross-platform components, reuse the visual UI while adapting interaction and accessibility behavior to each platform.
  • Use accessibility hooks to separate control behavior from presentation, especially for complex components such as menus and combo boxes.
  • Review keyboard navigation, visible focus, screen reader output, and contrast as part of accessibility work.

Mentioned in this talk

Search inside this talk

What was claimed 9

  • role at
    Sanket Sahu is software engineer at Geeks
    “I’m a software engineer at Geeks”
    YouTube
    Unverified1 source· Talk
  • feature
    React: Supports building accessible websites, often using standard HTML techniques
    “React fully supports building accessible websites, often by using standard HTML techniques.”
    YouTube
    Unverified1 source· Talk
  • feature
    React Native: Provides a unified accessibility API for iOS and Android
    “React Native provides a unified API for iOS and Android to make apps accessible.”
    YouTube
    Unverified1 source· Talk
  • feature
    React Aria: Provides React hooks for accessible UI primitives without supplying UI
    “React Aria provides a set of React hooks that anybody can use to build accessible UI primitives”
    YouTube
    Unverified1 source· Talk
  • built
    “This is a brilliant project by the Adobe team.”
    YouTube
    Unverified1 source· Talk
  • feature
    React Native Aria: Provides React hooks for accessible UI primitives on React Native and web
    “React Native Aria is a set of React hooks to build accessible UI primitives for React Native and web.”
    YouTube
    Unverified1 source· Talk
  • integrates with
    “It imports React Aria's useCheckbox and exports it.”
    YouTube
    Unverified1 source· Talk
  • feature
    NativeBase: Mobile-first library of accessible components for React Native and web
    “NativeBase is essentially a mobile-first library of accessible components for React Native and web.”
    YouTube
    Unverified1 source· Talk
  • uses
    “React Native Aria is used with many NativeBase components to make them accessible”
    YouTube
    Verified2 sources· Talk

Related talks