SlideShare a Scribd company logo
1 of 29
Download to read offline
React Accessibility
Poonam Tathavadkar, TurboTax Accessibility
CSUN 2018
Poonam pursued her Masters in Computer Science from Northeastern University and joined as a coop at Intuit in 2014. The amazing work and culture of the company
brought her back as a software engineer in 2015. She is currently working as an iOS/Front End engineer at TurboTax and is extremely passionate around the field of
accessibility, lead for Consumer Group Accessibility. Loves to learn new things, collaborate, share and learn from experiences, tackle challenges. Hobbies include
cooking different cuisines and traveling with her close ones.
React - A JavaScript view-rendering
library by Facebook
React - A framework for building native
apps using React
Role
State
Value
Label
JAVASCRIPT HOTNESS
HTML ATTRIBUTES AND
RESERVED WORDS
• Class is also a reserved word in JavaScript. When
assigning a class attribute on an HTML element for
styling, it must be written as className instead.

• For is a reserved word in JavaScript which is used to loop
through items. When creating label elements in React
components, you must use the htmlFor attribute instead
to set the explicit label + input relationship.
REACT ACCESSIBILITY
• Updating the page title

• Managing focus

• Code linting, plus a few more thoughts on creating
accessible React apps.
SETTING THE
PAGE TITLE
• React Apps are SPA’s (Single Page Architecture).

• Title element will display the same name set in the
content throughout browsing session- isn’t ideal !

• Title - first thing that’s announced. Critical to make sure it
reflects the content on the page.

• Declare title in generally public/index.html file.
We can get around this issue by dynamically setting the title element content in our parent components, or “pages” as required, by assigning a value to the
global document.title property. Where we set this is within React’s componentWillMount()lifecycle method. This is a function you use to run snippets of code when the
page loads.

https://simplyaccessible.com/article/react-a11y/
FOCUS MANAGEMENT
• Critical for both accessibility and user friendly application.

• Great candidate - multi page form, very easy for user to
get lost without focus management.

• Necessary to create something called as a function
reference in React - similar to selecting and HTML
element in the DOM and catching it in a variable.
Focus Management
Example
• Loading screen

• Ideal to focus on container that is loading
the message.

When this component is rendered, the function ref fires and creates a “reference” to the element by creating a new class property.
EXAMPLE - FOCUS
MANAGEMENT
<div tabIndex="-1"
ref="{(loadingContainer) =>
{this.loadingContainer =
loadingContainer}}">
<p>Loading…</p>
</div>
In this case, we create a reference to the div called “loadingContainer” and we pass it to a new class property via this.loadingContainer = loadingContainer assignment
statement.
EXAMPLE CONTINUED
componentDidMount() {
this.loadingContainer
.focus();
}
We use the ref in the componentDidMount() lifecycle hook to explicitly set focus to the “loading” container when the component loads 
Focus management
strategies
• In conclusion, there are 3 key focus management
strategies.

• User input event + focus on refs

• Assign focus via component state

• Focus on component mount/ update

• Focus layer system
React Unit Tests
• Rendering with props/ state 

• Handling interactions

• Snapshot testing
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly.

A typical snapshot test case for a mobile app renders a UI component, takes a screenshot, then compares it to a reference image stored alongside the test. The test will
fail if the two images do not match: either the change is unexpected, or the screenshot needs to be updated to the new version of the UI component.

When using Jest to test a React or React Native application, you can write a snapshot test that will save the output of a rendered component to file and compare the
component’s output to the snapshot on subsequent runs. This is useful in knowing when your component changes its behaviour.
Unit Testing Tools
• React Test Utils

• Enzyme

• Jest

• What these basically do is simulate events, shallow render
and mount components into the DOM
ENZYME is a library that wraps packages like React TestUtils, JSDOM and CheerIO to create a simpler interface for writing unit tests (work with shallow rendering).

ENZYME - https://www.npmjs.com/package/enzyme

REACT TEST UTILS - https://reactjs.org/docs/test-utils.html

JEST - https://facebook.github.io/jest/
Shallow Rendering - Basis
of React Unit Testing
Let’s you render a component “one level deep” and test
what its render method returns, without worrying about child
components, which are not instantiated or rendered. Does
not require a DOM
Reference - https://facebook.github.io/react/docs/test-
utils.html
Example
var shallow = require('enzyme').shallow;
// more code
it('escape key', function() {
var wrapper = shallow(el(Button, null, 'foo'), shallowOptions);
wrapper.simulate('keyDown', escapeEvent);
expect(ambManager.handleMenuKey).toHaveBeenCalledTimes(1);
expect(ambManager.handleMenuKey.mock.calls[0][0].key).toBe('Escape');
});
Reference - https://github.com/davidtheclark/react-aria-menubutton
Accessibility Tests
Requirements
• Computed name and role

• Color contrast

• Focus management with refs

• Visible focus state

• ARIA support
Tools for accessible
development
• eslint-plugin-jsx-a11y - ESLint plugin, specifically for JSX
and React.

• Reports any potential accessibility issues with the code.
Comes baked with a new React project. 

LINK TO PLUGIN - https://github.com/evcohen/eslint-plugin-jsx-a11y
Quick installation - eslint-
plugin-jsx-a11y
• Install the plugin using npm install

• Update the ESLint configuration

• add “jsx-a11y” to the “plugins” section

• Extend that plugin using 

“extends” : [

“plugin: jsx-a11y/recommended”

]
More React Accessibility
Tools
• React-axe

• React-a11y

• axe-webdriverjs
react-axe - https://www.npmjs.com/package/react-axe

react-a11y - https://github.com/reactjs/react-a11y

axe-webdriverjs - https://github.com/dequelabs/axe-webdriverjs
Key components
• react-modal

• react-autocomplete

• react-tabs

• react-aria-menubutton
React Native Accessibility
• Foundation of Accessibility API for React and
React Native is same.

• Basic functionalities include - easily making
View accessible.

• <View accessible = {true}
accessibilityLabel=“This is simple view”>
accessible={true}
iOS = isAccessibilityElement
Android = isFocusable
iOS uses isAccessibilityElement to define when an element is accessible

Android uses isFocusable

React native allows you to define this for both operating systems.
Key Attributes
accessibilityLabel (iOS, Android)
• Label
• A user-friendly label for element
accessibilityTraits (iOS)
• Role, State
• Define the type or state of element selected
Touchable Components
• React Native doesn’t expose components with
accessibility on by default.
• Created an overridable hack until updated
• No longer using the RN core Touchable
components
• The main component to create any sort of
button.
One of our developers had to extend that Touchable component with a small props change to make it work. A PR is sitting in facebooks github dormant for awhile until a
couple of weeks ago our same developer nudged facebook and then another contributor redid the PR with some small corrections and it was merged into FB about a
week ago. So that kind of shows the FB contributions pipeline a little bit.
EXAMPLE
<TouchableOpacity
accessible={true}
accessibilityLabel={'Tap me!’}
accessibilityTraits={‘button’} …>
<View>
<Text style=…>Press me!</Text>
</View>
</TouchableOpacity>
In the above example, the accessibilityLabel on the TouchableOpacity element would default to "Press me!". The label is constructed by concatenating all Text node
children separated by spaces.
Things to watch out for
• Capturing and non-React events

• SyntheticEvent is a wrapper utility

• Bind to accessible elements

• Reference - https://www.youtube.com/watch?
v=dRo_egw7tBc
Links for research
• https://reactjs.org/docs/accessibility.html

• https://simplyaccessible.com/article/react-a11y/

• https://code.facebook.com/posts/435862739941212/making-react-
native-apps-accessible/

• https://github.com/reactjs/react-a11y

• https://marcysutton.github.io/react-a11y-presentation/#/

• https://codepen.io/scottohara/pen/lIdfv

• https://www.24a11y.com/2017/reacts-accessibility-code-linter/
@poonamst14

More Related Content

What's hot

Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016
Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016
Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016gerardkcohen
 
Implementing Test Automation in Agile Projects
Implementing Test Automation in Agile ProjectsImplementing Test Automation in Agile Projects
Implementing Test Automation in Agile ProjectsDominik Dary
 
Agile Testing at eBay
Agile Testing at eBayAgile Testing at eBay
Agile Testing at eBayDominik Dary
 
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...Applitools
 
Real Devices or Emulators: Wen to use What for Automated Testing
Real Devices or Emulators: Wen to use What for Automated TestingReal Devices or Emulators: Wen to use What for Automated Testing
Real Devices or Emulators: Wen to use What for Automated TestingSauce Labs
 
Test Automation With Cucumber JVM, Selenium, and Mocha
Test Automation With Cucumber JVM, Selenium, and MochaTest Automation With Cucumber JVM, Selenium, and Mocha
Test Automation With Cucumber JVM, Selenium, and MochaSalesforce Developers
 
Beyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms OrganizationsBeyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms OrganizationsSauce Labs
 
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latestColorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latestOnur Baskirt
 
Automated Testing – Web, Mobile, Desktop - Challenges and Successes
Automated Testing – Web, Mobile, Desktop - Challenges and SuccessesAutomated Testing – Web, Mobile, Desktop - Challenges and Successes
Automated Testing – Web, Mobile, Desktop - Challenges and SuccessesTed Drake
 
Selenium Camp 2016 - Kiev, Ukraine
Selenium Camp 2016 -  Kiev, UkraineSelenium Camp 2016 -  Kiev, Ukraine
Selenium Camp 2016 - Kiev, UkraineJustin Ison
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)Sauce Labs
 
Myth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan Lipps
Myth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan LippsMyth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan Lipps
Myth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan LippsApplitools
 
Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflowcromwellryan
 
Make the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open SourceMake the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open SourcePerfecto by Perforce
 
Selenium conference, 2016
Selenium conference, 2016Selenium conference, 2016
Selenium conference, 2016Pooja Shah
 
What’s new in VS 2015 and ALM 2015
What’s new in VS 2015 and ALM 2015What’s new in VS 2015 and ALM 2015
What’s new in VS 2015 and ALM 2015SSW
 
Selenium and Open Source Advanced Testing
Selenium and Open Source Advanced TestingSelenium and Open Source Advanced Testing
Selenium and Open Source Advanced TestingAustin Marie Gay
 
Web Application Testing with Selenium
Web Application Testing with Selenium Web Application Testing with Selenium
Web Application Testing with Selenium Sargis Sargsyan
 

What's hot (20)

Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016
Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016
Accessibility Testing Tools for Developers - Gerard K. Cohen - CSUN 2016
 
Implementing Test Automation in Agile Projects
Implementing Test Automation in Agile ProjectsImplementing Test Automation in Agile Projects
Implementing Test Automation in Agile Projects
 
Agile Testing at eBay
Agile Testing at eBayAgile Testing at eBay
Agile Testing at eBay
 
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
[Webinar] Continuous Testing Done Right: Test Automation at the World's Leadi...
 
Real Devices or Emulators: Wen to use What for Automated Testing
Real Devices or Emulators: Wen to use What for Automated TestingReal Devices or Emulators: Wen to use What for Automated Testing
Real Devices or Emulators: Wen to use What for Automated Testing
 
Test Automation With Cucumber JVM, Selenium, and Mocha
Test Automation With Cucumber JVM, Selenium, and MochaTest Automation With Cucumber JVM, Selenium, and Mocha
Test Automation With Cucumber JVM, Selenium, and Mocha
 
Beyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms OrganizationsBeyond the Release: CI That Transforms Organizations
Beyond the Release: CI That Transforms Organizations
 
Appium vs Espresso and XCUI Test
Appium vs Espresso and XCUI TestAppium vs Espresso and XCUI Test
Appium vs Espresso and XCUI Test
 
Colorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latestColorful world-of-visual-automation-testing-latest
Colorful world-of-visual-automation-testing-latest
 
Automated Testing – Web, Mobile, Desktop - Challenges and Successes
Automated Testing – Web, Mobile, Desktop - Challenges and SuccessesAutomated Testing – Web, Mobile, Desktop - Challenges and Successes
Automated Testing – Web, Mobile, Desktop - Challenges and Successes
 
Selenium Camp 2016 - Kiev, Ukraine
Selenium Camp 2016 -  Kiev, UkraineSelenium Camp 2016 -  Kiev, Ukraine
Selenium Camp 2016 - Kiev, Ukraine
 
How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)How To Use Selenium Successfully (Java Edition)
How To Use Selenium Successfully (Java Edition)
 
Myth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan Lipps
Myth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan LippsMyth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan Lipps
Myth vs Reality: Understanding AI/ML for QA Automation - w/ Jonathan Lipps
 
Selenium + Specflow
Selenium + SpecflowSelenium + Specflow
Selenium + Specflow
 
Make the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open SourceMake the Shift from Manual to Automation with Open Source
Make the Shift from Manual to Automation with Open Source
 
Test automation process
Test automation processTest automation process
Test automation process
 
Selenium conference, 2016
Selenium conference, 2016Selenium conference, 2016
Selenium conference, 2016
 
What’s new in VS 2015 and ALM 2015
What’s new in VS 2015 and ALM 2015What’s new in VS 2015 and ALM 2015
What’s new in VS 2015 and ALM 2015
 
Selenium and Open Source Advanced Testing
Selenium and Open Source Advanced TestingSelenium and Open Source Advanced Testing
Selenium and Open Source Advanced Testing
 
Web Application Testing with Selenium
Web Application Testing with Selenium Web Application Testing with Selenium
Web Application Testing with Selenium
 

Similar to React a11y-csun

React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)Chiew Carol
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react jsStephieJohn
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptxSHAIKIRFAN715544
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxSHAIKIRFAN715544
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theoryjobinThomas54
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
What are the components in React?
What are the components in React?What are the components in React?
What are the components in React?BOSC Tech Labs
 
Lecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptxLecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptxGevitaChinnaiah
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperFabrit Global
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today Nitin Tyagi
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Previewvaluebound
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React EcosystemFITC
 
React Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdfReact Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdfBOSC Tech Labs
 

Similar to React a11y-csun (20)

React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)React Native +Redux + ES6 (Updated)
React Native +Redux + ES6 (Updated)
 
Fundamental concepts of react js
Fundamental concepts of react jsFundamental concepts of react js
Fundamental concepts of react js
 
Introduction to React JS.pptx
Introduction to React JS.pptxIntroduction to React JS.pptx
Introduction to React JS.pptx
 
Introduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptxIntroduction to ReactJS UI Web Dev .pptx
Introduction to ReactJS UI Web Dev .pptx
 
Reactjs notes.pptx for web development- tutorial and theory
Reactjs  notes.pptx for web development- tutorial and theoryReactjs  notes.pptx for web development- tutorial and theory
Reactjs notes.pptx for web development- tutorial and theory
 
React-JS.pptx
React-JS.pptxReact-JS.pptx
React-JS.pptx
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Presentation1
Presentation1Presentation1
Presentation1
 
What are the components in React?
What are the components in React?What are the components in React?
What are the components in React?
 
Lecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptxLecture 1 Introduction to React Native.pptx
Lecture 1 Introduction to React Native.pptx
 
Getting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular DeveloperGetting Started with React, When You’re an Angular Developer
Getting Started with React, When You’re an Angular Developer
 
Reactjs
Reactjs Reactjs
Reactjs
 
React - Start learning today
React - Start learning today React - Start learning today
React - Start learning today
 
Tech Talk on ReactJS
Tech Talk on ReactJSTech Talk on ReactJS
Tech Talk on ReactJS
 
reactJS
reactJSreactJS
reactJS
 
React JS: A Secret Preview
React JS: A Secret PreviewReact JS: A Secret Preview
React JS: A Secret Preview
 
An Overview of the React Ecosystem
An Overview of the React EcosystemAn Overview of the React Ecosystem
An Overview of the React Ecosystem
 
React Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdfReact Best Practices All Developers Should Follow in 2024.pdf
React Best Practices All Developers Should Follow in 2024.pdf
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
learning react
learning reactlearning react
learning react
 

Recently uploaded

Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapRishantSharmaFr
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfRagavanV2
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 

Recently uploaded (20)

Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 

React a11y-csun

  • 1. React Accessibility Poonam Tathavadkar, TurboTax Accessibility CSUN 2018 Poonam pursued her Masters in Computer Science from Northeastern University and joined as a coop at Intuit in 2014. The amazing work and culture of the company brought her back as a software engineer in 2015. She is currently working as an iOS/Front End engineer at TurboTax and is extremely passionate around the field of accessibility, lead for Consumer Group Accessibility. Loves to learn new things, collaborate, share and learn from experiences, tackle challenges. Hobbies include cooking different cuisines and traveling with her close ones.
  • 2. React - A JavaScript view-rendering library by Facebook React - A framework for building native apps using React
  • 5. HTML ATTRIBUTES AND RESERVED WORDS • Class is also a reserved word in JavaScript. When assigning a class attribute on an HTML element for styling, it must be written as className instead. • For is a reserved word in JavaScript which is used to loop through items. When creating label elements in React components, you must use the htmlFor attribute instead to set the explicit label + input relationship.
  • 6. REACT ACCESSIBILITY • Updating the page title • Managing focus • Code linting, plus a few more thoughts on creating accessible React apps.
  • 7. SETTING THE PAGE TITLE • React Apps are SPA’s (Single Page Architecture). • Title element will display the same name set in the content throughout browsing session- isn’t ideal ! • Title - first thing that’s announced. Critical to make sure it reflects the content on the page. • Declare title in generally public/index.html file. We can get around this issue by dynamically setting the title element content in our parent components, or “pages” as required, by assigning a value to the global document.title property. Where we set this is within React’s componentWillMount()lifecycle method. This is a function you use to run snippets of code when the page loads. https://simplyaccessible.com/article/react-a11y/
  • 8. FOCUS MANAGEMENT • Critical for both accessibility and user friendly application. • Great candidate - multi page form, very easy for user to get lost without focus management. • Necessary to create something called as a function reference in React - similar to selecting and HTML element in the DOM and catching it in a variable.
  • 9. Focus Management Example • Loading screen • Ideal to focus on container that is loading the message. When this component is rendered, the function ref fires and creates a “reference” to the element by creating a new class property.
  • 10. EXAMPLE - FOCUS MANAGEMENT <div tabIndex="-1" ref="{(loadingContainer) => {this.loadingContainer = loadingContainer}}"> <p>Loading…</p> </div> In this case, we create a reference to the div called “loadingContainer” and we pass it to a new class property via this.loadingContainer = loadingContainer assignment statement.
  • 11. EXAMPLE CONTINUED componentDidMount() { this.loadingContainer .focus(); } We use the ref in the componentDidMount() lifecycle hook to explicitly set focus to the “loading” container when the component loads 
  • 12. Focus management strategies • In conclusion, there are 3 key focus management strategies. • User input event + focus on refs • Assign focus via component state • Focus on component mount/ update • Focus layer system
  • 13. React Unit Tests • Rendering with props/ state • Handling interactions • Snapshot testing Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly. A typical snapshot test case for a mobile app renders a UI component, takes a screenshot, then compares it to a reference image stored alongside the test. The test will fail if the two images do not match: either the change is unexpected, or the screenshot needs to be updated to the new version of the UI component. When using Jest to test a React or React Native application, you can write a snapshot test that will save the output of a rendered component to file and compare the component’s output to the snapshot on subsequent runs. This is useful in knowing when your component changes its behaviour.
  • 14. Unit Testing Tools • React Test Utils • Enzyme • Jest • What these basically do is simulate events, shallow render and mount components into the DOM ENZYME is a library that wraps packages like React TestUtils, JSDOM and CheerIO to create a simpler interface for writing unit tests (work with shallow rendering). ENZYME - https://www.npmjs.com/package/enzyme REACT TEST UTILS - https://reactjs.org/docs/test-utils.html JEST - https://facebook.github.io/jest/
  • 15. Shallow Rendering - Basis of React Unit Testing Let’s you render a component “one level deep” and test what its render method returns, without worrying about child components, which are not instantiated or rendered. Does not require a DOM Reference - https://facebook.github.io/react/docs/test- utils.html
  • 16. Example var shallow = require('enzyme').shallow; // more code it('escape key', function() { var wrapper = shallow(el(Button, null, 'foo'), shallowOptions); wrapper.simulate('keyDown', escapeEvent); expect(ambManager.handleMenuKey).toHaveBeenCalledTimes(1); expect(ambManager.handleMenuKey.mock.calls[0][0].key).toBe('Escape'); }); Reference - https://github.com/davidtheclark/react-aria-menubutton
  • 17. Accessibility Tests Requirements • Computed name and role • Color contrast • Focus management with refs • Visible focus state • ARIA support
  • 18. Tools for accessible development • eslint-plugin-jsx-a11y - ESLint plugin, specifically for JSX and React. • Reports any potential accessibility issues with the code. Comes baked with a new React project. LINK TO PLUGIN - https://github.com/evcohen/eslint-plugin-jsx-a11y
  • 19. Quick installation - eslint- plugin-jsx-a11y • Install the plugin using npm install • Update the ESLint configuration • add “jsx-a11y” to the “plugins” section • Extend that plugin using “extends” : [ “plugin: jsx-a11y/recommended” ]
  • 20. More React Accessibility Tools • React-axe • React-a11y • axe-webdriverjs react-axe - https://www.npmjs.com/package/react-axe react-a11y - https://github.com/reactjs/react-a11y axe-webdriverjs - https://github.com/dequelabs/axe-webdriverjs
  • 21. Key components • react-modal • react-autocomplete • react-tabs • react-aria-menubutton
  • 22. React Native Accessibility • Foundation of Accessibility API for React and React Native is same. • Basic functionalities include - easily making View accessible. • <View accessible = {true} accessibilityLabel=“This is simple view”>
  • 23. accessible={true} iOS = isAccessibilityElement Android = isFocusable iOS uses isAccessibilityElement to define when an element is accessible Android uses isFocusable React native allows you to define this for both operating systems.
  • 24. Key Attributes accessibilityLabel (iOS, Android) • Label • A user-friendly label for element accessibilityTraits (iOS) • Role, State • Define the type or state of element selected
  • 25. Touchable Components • React Native doesn’t expose components with accessibility on by default. • Created an overridable hack until updated • No longer using the RN core Touchable components • The main component to create any sort of button. One of our developers had to extend that Touchable component with a small props change to make it work. A PR is sitting in facebooks github dormant for awhile until a couple of weeks ago our same developer nudged facebook and then another contributor redid the PR with some small corrections and it was merged into FB about a week ago. So that kind of shows the FB contributions pipeline a little bit.
  • 26. EXAMPLE <TouchableOpacity accessible={true} accessibilityLabel={'Tap me!’} accessibilityTraits={‘button’} …> <View> <Text style=…>Press me!</Text> </View> </TouchableOpacity> In the above example, the accessibilityLabel on the TouchableOpacity element would default to "Press me!". The label is constructed by concatenating all Text node children separated by spaces.
  • 27. Things to watch out for • Capturing and non-React events • SyntheticEvent is a wrapper utility • Bind to accessible elements • Reference - https://www.youtube.com/watch? v=dRo_egw7tBc
  • 28. Links for research • https://reactjs.org/docs/accessibility.html • https://simplyaccessible.com/article/react-a11y/ • https://code.facebook.com/posts/435862739941212/making-react- native-apps-accessible/ • https://github.com/reactjs/react-a11y • https://marcysutton.github.io/react-a11y-presentation/#/ • https://codepen.io/scottohara/pen/lIdfv • https://www.24a11y.com/2017/reacts-accessibility-code-linter/