Skip to content

Commit

Permalink
Change heading prop back to old name
Browse files Browse the repository at this point in the history
  • Loading branch information
sarah-j-lancaster committed Dec 16, 2021
1 parent 3709578 commit ce96eaa
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Enables external control of the expansion.
Class(es) to apply to the 'heading' element.
#### ariaLevel : `number` [*optional*, default: `3`]
#### aria-level : `number` [*optional*, default: `3`]
Will determine which 'heading' element is used in the markup. A value of `1`
would make your element an `<h1>` tag, and likewise a value of `6` would make it
Expand Down Expand Up @@ -200,7 +200,7 @@ spec-compliant:
- Only ever use
[phrasing content](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content)
inside of your `AccordionItemHeading` component. If in doubt, use text only.
- Remember to provide an `ariaLevel` prop to your `AccordionItemHeading`
- Remember to provide an `aria-level` prop to your `AccordionItemHeading`
component, when you are nesting accordions. The levels are used by assistive
technologies (eg. screenreaders) to infer structure, by default each heading
uses `h3` .
Expand Down
4 changes: 2 additions & 2 deletions src/components/AccordionItemHeading.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('AccordionItem', () => {
});
});

describe('ariaLevel prop', () => {
describe('aria-level prop', () => {
it('is h3 by default', () => {
const { getByTestId } = render(
<Accordion>
Expand All @@ -80,7 +80,7 @@ describe('AccordionItem', () => {
<AccordionItem>
<AccordionItemHeading
data-testid={UUIDS.FOO}
ariaLevel={4}
aria-level={4}
>
<AccordionItemButton />
</AccordionItemHeading>
Expand Down
4 changes: 2 additions & 2 deletions src/components/AccordionItemHeading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { assertValidHtmlId } from '../helpers/uuid';

interface AccordianItemHeadingProps extends HeadingAttributes {
className?: string;
ariaLevel?: number;
'aria-level'?: number;
}

export const SPEC_ERROR = `AccordionItemButton may contain only one child element, which must be an instance of AccordionItemButton.
Expand All @@ -19,7 +19,7 @@ From the WAI-ARIA spec (https://www.w3.org/TR/wai-aria-practices-1.1/#accordion)
const Heading = React.forwardRef<HTMLHeadingElement, AccordianItemHeadingProps>(
(
{
ariaLevel = 3,
'aria-level': ariaLevel = 3,
className = 'accordion__heading',
...props
}: AccordianItemHeadingProps,
Expand Down

0 comments on commit ce96eaa

Please sign in to comment.