Open MaxFrank13 opened 1 year ago
From Paragon Working Group discussion:
rowProps
as a name to keep it flexibleQuestion for future development: if this pattern becomes more popular, should the ability to expand the CardGrid
become a native part of the component?
Improvements
The
CardGrid
component renders a list of cards inside a BootstrapRow
. In some cases, we may want to make thisCardGrid
expandable — meaning the majority of the cards will be hidden until a toggle button is hit.If we want to support this behavior, we need to make it accessible by providing an
id
attribute to theRow
that wraps all of the cards. Thisid
is then associated with thearia-controls
attribute of the button that expands the list. This button also has anaria-expanded
attribute set to a boolean.From MDN:
The
Row
is being wrapped in adiv
so we will need to provide a new prop to theCardGrid
component, either:rowProps
if we want to support forwarding any number of props to the RowrowID
if we just want to support forwarding theid
Note: definitely open to feedback on how to name the new prop, these are just suggestions
https://github.com/openedx/paragon/blob/319b694354a2dcd55cdcb3bfed60587de13f6f40/src/Card/CardGrid.jsx#L31-L35
Resources
MDN on aria-expanded