From 4c91412810bb4fc5d4bc064ba1639fb26ab792bb Mon Sep 17 00:00:00 2001 From: Josh Black Date: Tue, 7 Apr 2020 12:41:42 -0500 Subject: [PATCH 1/2] fix(accordion): add aria-controls on each accordion item (#5787) * fix(accordion): add aria-controls on each accordion item * test(accordion): update snapshots * chore(react): fix eslint violations Co-authored-by: TJ Egan --- .../src/components/Accordion/AccordionItem.js | 7 +++- .../__snapshots__/Accordion-test.js.snap | 9 ++++++ .../__snapshots__/AccordionItem-test.js.snap | 3 ++ .../src/internal/__tests__/useId-test.js | 32 +++++++++++++++++++ packages/react/src/internal/useId.js | 21 ++++++++++++ 5 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 packages/react/src/internal/__tests__/useId-test.js create mode 100644 packages/react/src/internal/useId.js diff --git a/packages/react/src/components/Accordion/AccordionItem.js b/packages/react/src/components/Accordion/AccordionItem.js index 4482a541c4a3..e99ecd40f537 100644 --- a/packages/react/src/components/Accordion/AccordionItem.js +++ b/packages/react/src/components/Accordion/AccordionItem.js @@ -11,6 +11,7 @@ import cx from 'classnames'; import PropTypes from 'prop-types'; import React, { useState } from 'react'; import { match, keys } from '../../internal/keyboard'; +import { useId } from '../../internal/useId'; const { prefix } = settings; const defaultRenderExpando = props =>