
React Aria
Implement custom accessible React UIs with React Aria Components and optional pattern test utilities instead of guessing ARIA behavior.
Install
npx skills add https://github.com/react-aria.adobe.com --skill react-ariaWhat is this skill?
- Official Adobe guidance for react-aria-components and accessible unstyled primitives
- Documents @react-aria/test-utils with User, interactionType, and advanceTimer setup
- Pattern testers simulate mouse, keyboard, and touch for component tests
- Apache-2.0 licensed skill tied to react-aria.adobe.com documentation
- Requires an installed React project with react-aria-components compatibility
Adoption & trust: 1.2k installs on skills.sh; 1/1 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Journey fit
Build is the primary journey phase because the skill documents component APIs, hooks, and frontend test patterns while you are implementing UI. Frontend subphase matches React Aria Components, unstyled primitives, and @react-aria/test-utils for interaction simulation.
Common Questions / FAQ
Is React Aria safe to install?
skills.sh reports 1 of 1 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - React Aria
# React Aria Components ## Test utilities `@react-aria/test-utils` provides ARIA pattern testers that simulate mouse, keyboard, and touch interactions for components built with React Aria Components. ### Installation ```bash npm install @react-aria/test-utils --save-dev ``` ### Core pattern External consumers should import from `@react-aria/test-utils`. Initialize a `User` once per test file. Call `createTester` to get a tester for a specific ARIA pattern, then call tester methods to simulate interactions. ```ts import {User} from '@react-aria/test-utils'; // Provide whatever method of advancing timers you use in your test, this example assumes Jest with fake timers. // 'interactionType' specifies what mode of interaction should be simulated by the tester // 'advanceTimer' is used by the tester to advance the timers in the tests for specific interactions (e.g. long press) let testUtilUser = new User({interactionType: 'mouse', advanceTimer: jest.advanceTimersByTime}); it('my test case', async function () { // Render your test component/app let {getByTestId} = render(); // Initialize the table tester via providing the 'Table' pattern name and the root element of said table let tableTester = testUtilUser.createTester('Table', {root: getByTestId('test_table')}); expect(tableTester.getSelectedRows()).toHaveLength(0); await tableTester.toggleSelectAll(); expect(tableTester.getSelectedRows()).toHaveLength(10); ... }); ``` Set `interactionType` to `'mouse'`, `'keyboard'`, or `'touch'`. Override per tester via `createTester(..., {interactionType})` or per method call. When using fake timers, pass `advanceTimer: jest.advanceTimersByTime` and flush timers after each test: ```ts afterEach(() => { act(() => jest.runAllTimers()); }); ``` ### Tips and Tricks - The testers typically offers these things: a way to simulate common user interactions for the given component via a specified user modality (e.g. using mouse vs keyboard to toggle a menu), a way to get the various common elements that make up the component (e.g. the rows in a table), and a way to query the state of the component (e.g. get the selected rows in a table). Prefer using the testers for these use cases so that the user doesn't need to know what specific roles/elements/etc to target in their tests. - You can still simulate interactions manually in your test alongside the utilities provided by the tester. This can come in handy if you find that the tester doesn't cover a specific user flow or if one of its utilities isn't quite working as expected. After simulating your interaction, you can still use the tester to query for the component's state or trigger a different interaction utility. - Mouse drag interactions, simulated scrolling, and other mock reliant interactions are not available in these test utils since they depend heavily on how the user mocks things like clientHeight/Width/etc in their tests. These interactions need to be simulated manually by the user. - Some testers may support the notion of "long press" for certain interactions (e.g. long pressing a button to trigger its menu). To simulate this, you will need mock PointerEvent globally (see the installPointerEvent util) and provide a way to advance timers to the User via `advanceTimer`. - These test utils are compatible with not only JSDOM unit tests but browser tests as well (e.g. vitest-browser-react). - Methods that accept a target (`option`, `row`, `column`, `checkbox`, `radio`, `tab`) take a `number`