hig icon indicating copy to clipboard operation
hig copied to clipboard

Ensure all components can accept an `id` attribute

Open dylankenneally opened this issue 4 years ago • 0 comments

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

  1. review the existing components' application of id attributes
  2. form a list of elements that do not permit the id attribute to be set
  3. apply the existing pattern found in pt 1 above to the items in pt 2
  4. apply unit tests as appropriate

cc: @wmui51, re: slack converstion about this issue

dylankenneally avatar Oct 01 '20 22:10 dylankenneally