diff --git a/.changeset/lemon-seahorses-argue.md b/.changeset/lemon-seahorses-argue.md new file mode 100644 index 00000000000..2dc1ae23a49 --- /dev/null +++ b/.changeset/lemon-seahorses-argue.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +ActionBar now produces valid HTML diff --git a/packages/react/src/drafts/ActionBar/ActionBar.test.tsx b/packages/react/src/drafts/ActionBar/ActionBar.test.tsx new file mode 100644 index 00000000000..340a8d0238c --- /dev/null +++ b/packages/react/src/drafts/ActionBar/ActionBar.test.tsx @@ -0,0 +1,35 @@ +import React from 'react' +import {behavesAsComponent} from '../../utils/testing' +import {render as HTMLRender} from '@testing-library/react' +import {axe} from 'jest-axe' + +import ActionBar from './' +import {BoldIcon, CodeIcon, ItalicIcon, LinkIcon} from '@primer/octicons-react' + +const SimpleActionBar = () => ( + + + + + + + +) + +describe('ActionBar', () => { + afterEach(() => { + jest.clearAllMocks() + }) + + behavesAsComponent({ + Component: ActionBar, + options: {skipAs: true, skipSx: true}, + toRender: () => , + }) + + it('should have no axe violations', async () => { + const {container} = HTMLRender() + const results = await axe(container) + expect(results).toHaveNoViolations() + }) +}) diff --git a/packages/react/src/drafts/ActionBar/ActionBar.tsx b/packages/react/src/drafts/ActionBar/ActionBar.tsx index e9d88ec06c3..817aaa08420 100644 --- a/packages/react/src/drafts/ActionBar/ActionBar.tsx +++ b/packages/react/src/drafts/ActionBar/ActionBar.tsx @@ -42,7 +42,7 @@ export type ActionBarProps = { export type ActionBarIconButtonProps = IconButtonProps -const NavigationList = styled.ul` +const NavigationList = styled.div` ${sx}; ` @@ -54,7 +54,7 @@ const MoreMenuListItem = styled.li` height: ${MORE_BTN_HEIGHT}px; ` -const ulStyles = { +const listStyles = { display: 'flex', listStyle: 'none', whiteSpace: 'nowrap', @@ -188,7 +188,7 @@ export const ActionBar: React.FC> = prop }, []) const navRef = useRef(null) - const listRef = useRef(null) + const listRef = useRef(null) const moreMenuRef = useRef(null) const moreMenuBtnRef = useRef(null) const containerRef = React.useRef(null) @@ -254,7 +254,7 @@ export const ActionBar: React.FC> = prop return ( - + {listItems} {menuItems.length > 0 && (