hig
hig copied to clipboard
Ensure all components can accept an `id` attribute
We've noticed that we're not able to set an id
on some HIG elements, such as <Accordion>
("@hig/accordion": "^1.1.1",), so we've been wrapping these as follows:
export default function AccordionWrapper({ id, label, children, className = undefined }) {
// span is because HIG's accordion doesn't support setting an ID
return <span id={id}>
<Accordion label={label} defaultCollapsed={isCollapsed(id)} onClick={() => storeInvertedCollapsed(id)} className={className || ''}>
{children}
</Accordion>
</span>;
}
To be done
- review the existing components' application of
id
attributes - form a list of elements that do not permit the
id
attribute to be set - apply the existing pattern found in pt 1 above to the items in pt 2
- apply unit tests as appropriate
cc: @wmui51, re: slack converstion about this issue