Skip to content
This repository has been archived by the owner on Apr 25, 2024. It is now read-only.

Commit

Permalink
Avoid invalid nesting of <span> within a <dd> in summary list
Browse files Browse the repository at this point in the history
  • Loading branch information
andymantell committed Jan 29, 2022
1 parent 738b62c commit 6bdf4ed
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/govuk/components/summary-list/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function ActionLink(props) {
);
}

function actions(row, anyRowHasActions) {
function actions(row) {
const actionLinks = row.actions?.items.map((action, index) => {
const { reactListKey, ...actionAttributes } = action;
return <ActionLink key={reactListKey || index} {...actionAttributes} />;
Expand Down Expand Up @@ -61,11 +61,6 @@ function actions(row, anyRowHasActions) {
);
}

if (anyRowHasActions) {
// Add dummy column to extend border
return <span className="govuk-summary-list__actions" />;
}

return null;
}

Expand All @@ -81,7 +76,11 @@ function SummaryList(props) {
{filteredRows.map((row, index) => (
<div
key={row.reactListKey || index}
className={`govuk-summary-list__row ${row.className || ''}`}
className={`govuk-summary-list__row ${
anyRowHasActions && !row.actions?.items
? 'govuk-summary-list__row--no-actions'
: ''
} ${row.className || ''}`}
>
<dt className={`govuk-summary-list__key ${row.key?.className || ''}`}>
{row.key?.children}
Expand All @@ -94,7 +93,7 @@ function SummaryList(props) {
{row.value?.children}
</dd>

{actions(row, anyRowHasActions)}
{actions(row)}
</div>
))}
</dl>
Expand Down

0 comments on commit 6bdf4ed

Please sign in to comment.