react-accessible-accordion
react-accessible-accordion copied to clipboard
Slight improvement - accessibility
Hey there - if you alter the following code to use button
instead of div
you can remove the need for an role
attribute as the button
element is being used.
Before
<div
className={className}
{...rest}
role="button"
tabIndex={0}
onClick={toggleExpanded}
onKeyDown={handleKeyPress}
data-accordion-component="AccordionItemButton"
/>
After
<button
className={className}
{...rest}
tabIndex={0}
onClick={toggleExpanded}
onKeyDown={handleKeyPress}
data-accordion-component="AccordionItemButton"
/>
Other notes
There might be some styling and other changes but it would be a improvement ✌🏼