Skip to content

Commit

Permalink
Filter panel: Force checkbox/radio background
Browse files Browse the repository at this point in the history
GOV.UK Frontend radio and checkboxes are rendered with a transparent
background, which makes them look wrong on this component's grey
background. This is intentional in GOV.UK Frontend and unlikely to
change (see alphagov/govuk-frontend#1625).
  • Loading branch information
csutter committed Sep 20, 2024
1 parent 381b0f1 commit c921d75
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/assets/stylesheets/components/_filter-panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,14 @@

@include govuk-font(19);
}

// GOV.UK Frontend radio and checkboxes are rendered with a transparent background, which makes them
// look wrong on this component's grey background. This is intentional in GOV.UK Frontend and
// unlikely to change (see https://github.com/alphagov/govuk-frontend/issues/1625).
.app-c-filter-panel__content {
.govuk-checkboxes__label, .govuk-radios__label {
&::before {
background-color: govuk-colour('white');
}
}
}
38 changes: 38 additions & 0 deletions app/views/components/docs/filter_panel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,44 @@ examples:
} do %>
<span>filter section content</span>
<% end %>
with_radios_and_checkboxes:
description: |
Overrides default styles of GOV.UK Frontend radios and checkboxes to ensure they have a white
background despite being inside a grey panel.
data:
button_text: Filter with radios and checkboxes
open: true
block: |
<div class="govuk-!-padding-4">
<%= render "govuk_publishing_components/components/radio", {
heading: "Radios",
name: "radio",
small: true,
items: [
{ value: "1", text: "Radio 1" },
{ value: "2", text: "Radio 2", checked: true }
]
} %>
<%= render "govuk_publishing_components/components/checkboxes", {
name: "checkbox",
heading: "Checkboxes",
small: true,
items: [
{
label: "Red",
value: "red"
},
{
label: "Green",
value: "green"
},
{
label: "Blue",
value: "blue"
}
]
} %>
</div>
with_margin_bottom:
description: |
Allows the spacing at the bottom of the component to be adjusted.
Expand Down

0 comments on commit c921d75

Please sign in to comment.