Skip to content

Commit

Permalink
Merge pull request #4454 from alphagov/revert-add-the-component-wrapp…
Browse files Browse the repository at this point in the history
…er-helper-to-fieldsets-2

**BREAKING** Stop setting `id` on fieldsets
  • Loading branch information
dnkrj authored Nov 29, 2024
2 parents 7bd137c + 17970ae commit 1865a44
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
useful summary for people upgrading their application, not a replication
of the commit log.

## Unreleased

* **BREAKING** Stop setting `id` on fieldsets ([PR #4454](https://github.com/alphagov/govuk_publishing_components/pull/4454))

## 45.10.0

* Add 'toggle' module to each expandable region in metadata component ([PR #4397](https://github.com/alphagov/govuk_publishing_components/pull/4397))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
heading_size = false unless shared_helper.valid_heading_size?(heading_size)
error_message ||= nil
error_id ||= nil
id ||= nil

if error_message
error_id = "error-#{SecureRandom.hex(4)}" unless error_id
Expand All @@ -27,7 +26,7 @@
legend_classes << "govuk-fieldset__legend--#{heading_size}" if heading_size
%>
<%= tag.div(**component_helper.all_attributes) do %>
<%= tag.fieldset class: fieldset_classes, aria: { describedby: describedby }, role: role, id: id do %>
<%= tag.fieldset class: fieldset_classes, aria: { describedby: describedby }, role: role do %>
<% if heading_level %>
<%= tag.legend class: legend_classes do %>
<%= content_tag(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ body: |
You can use the `text` property or pass `text` as a block.
accessibility_criteria: |
- must give inputs within the fieldset context with legend text
uses_component_wrapper_helper: true
examples:
default:
data:
Expand Down
10 changes: 0 additions & 10 deletions spec/components/fieldset_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,6 @@ def component_name
assert_select ".gem-c-fieldset", text: /Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel ad neque, maxime est ea laudantium totam fuga!/
end

it "renders a fieldset with an id" do
render_component(
legend_text: "Do you have a passport?",
id: "passports",
text: "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel ad neque, maxime est ea laudantium totam fuga!",
)

assert_select ".govuk-fieldset#passports"
end

it "renders a fieldset with the legend as heading" do
render_component(
legend_text: "Do you have a passport?",
Expand Down

0 comments on commit 1865a44

Please sign in to comment.