SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 
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
 
React Native Components Building Blocks for Dynamic Apps.pdf
React Native Components Building Blocks for Dynamic Apps.pdfReact Native Components Building Blocks for Dynamic Apps.pdf
React Native Components Building Blocks for Dynamic Apps.pdfGargi Raghav
 

Ähnlich wie 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
 
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
 
React Native Components Building Blocks for Dynamic Apps.pdf
React Native Components Building Blocks for Dynamic Apps.pdfReact Native Components Building Blocks for Dynamic Apps.pdf
React Native Components Building Blocks for Dynamic Apps.pdf
 

Kürzlich hochgeladen

8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitterShivangiSharma879191
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxsomshekarkn64
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleAlluxio, Inc.
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction managementMariconPadriquez1
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...Chandu841456
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptJasonTagapanGulla
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 

Kürzlich hochgeladen (20)

8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter8251 universal synchronous asynchronous receiver transmitter
8251 universal synchronous asynchronous receiver transmitter
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
lifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptxlifi-technology with integration of IOT.pptx
lifi-technology with integration of IOT.pptx
 
Correctly Loading Incremental Data at Scale
Correctly Loading Incremental Data at ScaleCorrectly Loading Incremental Data at Scale
Correctly Loading Incremental Data at Scale
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
computer application and construction management
computer application and construction managementcomputer application and construction management
computer application and construction management
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...An experimental study in using natural admixture as an alternative for chemic...
An experimental study in using natural admixture as an alternative for chemic...
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Solving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.pptSolving The Right Triangles PowerPoint 2.ppt
Solving The Right Triangles PowerPoint 2.ppt
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 

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/