Browse Source

Merge pull request #659 from sophiebits/a11y

Improve a11y of docs
main
Alex Krolick 7 years ago
committed by GitHub
parent
commit
c091475f92
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/templates/components/Sidebar/Section.js

16
src/templates/components/Sidebar/Section.js

@ -10,7 +10,10 @@ import isItemActive from 'utils/isItemActive';
import MetaTitle from '../MetaTitle';
import ChevronSvg from '../ChevronSvg';
const Section = ({
class Section extends React.Component {
state = {uid: ('' + Math.random()).replace(/\D/g, '')};
render() {
const {
activeItemId,
createLink,
isActive,
@ -19,9 +22,13 @@ const Section = ({
onLinkClick,
onSectionTitleClick,
section,
}) => (
} = this.props;
const uid = 'section_' + this.state.uid;
return (
<div>
<button
aria-expanded={isActive}
aria-controls={uid}
css={{
cursor: 'pointer',
backgroundColor: 'transparent',
@ -54,6 +61,7 @@ const Section = ({
</MetaTitle>
</button>
<ul
id={uid}
css={{
marginBottom: 10,
@ -98,6 +106,8 @@ const Section = ({
))}
</ul>
</div>
);
);
}
}
export default Section;

Loading…
Cancel
Save