Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update calls to textarea component with the id option #2373

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ GEM
govuk_personalisation (1.1.0)
plek (>= 1.9.0)
rails (>= 6, < 9)
govuk_publishing_components (49.1.0)
govuk_publishing_components (50.0.0)
govuk_app_config
govuk_personalisation (>= 0.7.0)
kramdown
Expand Down Expand Up @@ -233,7 +233,7 @@ GEM
activesupport (>= 3.0)
nokogiri (>= 1.6)
io-console (0.8.0)
irb (1.15.0)
irb (1.15.1)
pp (>= 0.6.0)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
Expand Down
4 changes: 2 additions & 2 deletions app/views/components/_markdown_editor.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<%= tag.div class: component_classes do %>

<%= render "govuk_publishing_components/components/label", {
html_for: textarea[:id],
html_for: textarea[:textarea_id],
}.merge(label.symbolize_keys) %>

<% if error_message.present? %>
Expand All @@ -21,7 +21,7 @@
<div class="app-c-markdown-editor__container">
<div class="app-c-markdown-editor__head">
<div class="app-c-markdown-editor__toolbar">
<markdown-toolbar class="app-c-markdown-editor__toolbar-group" for="<%= textarea[:id] %>">
<markdown-toolbar class="app-c-markdown-editor__toolbar-group" for="<%= textarea[:textarea_id] %>">
<% if controls.include?(:headings) %>
<md-header-2 class="app-c-markdown-editor__toolbar-button" title="Heading level 2" aria-label="Heading level 2">
<%= inline_svg_tag "components/markdown-editor/heading-two.svg", class: "app-c-markdown-editor__toolbar-icon" , aria_hidden: true %>
Expand Down
10 changes: 5 additions & 5 deletions app/views/components/docs/markdown_editor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ examples:
text: Body
textarea:
name: markdown-editor
id: markdown-editor
textarea_id: markdown-editor
with_bullet_list_button:
data:
controls:
Expand All @@ -34,7 +34,7 @@ examples:
text: Body
textarea:
name: markdown-editor
id: markdown-editor
textarea_id: markdown-editor
with_headings_buttons:
data:
controls:
Expand All @@ -43,7 +43,7 @@ examples:
text: Body
textarea:
name: markdown-editor
id: markdown-editor
textarea_id: markdown-editor
with_blockquote_button:
data:
controls:
Expand All @@ -52,7 +52,7 @@ examples:
text: Body
textarea:
name: markdown-editor
id: markdown-editor
textarea_id: markdown-editor
with_numbered_list_button:
data:
controls:
Expand All @@ -61,4 +61,4 @@ examples:
text: Body
textarea:
name: markdown-editor
id: markdown-editor
textarea_id: markdown-editor
2 changes: 1 addition & 1 deletion app/views/coronavirus/pages/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
},
textarea: {
name: "landing_page[header_body]",
id: "header_body",
textarea_id: "header_body",
rows: 20,
value: @page.header_body,
},
Expand Down
4 changes: 2 additions & 2 deletions app/views/coronavirus/sub_sections/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
bold: true,
},
name: "sub_section[action_link_summary]",
id: "action_link_summary",
textarea_id: "action_link_summary",
value: @sub_section.action_link_summary,
rows: 5,
error_message: error_items(@sub_section.errors.messages, :action_link_summary),
Expand All @@ -77,7 +77,7 @@
},
textarea: {
name: "sub_section[content]",
id: "content",
textarea_id: "content",
rows: 20,
value: @sub_section.content,
},
Expand Down
2 changes: 1 addition & 1 deletion app/views/review/submit_2i_verdict.erb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
label: {
text: t("step_by_step_pages.#{review_phrase}.label"),
},
id: "additional-comments",
textarea_id: "additional-comments",
name: textarea_name,
} %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/review/submit_for_2i.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
text: t("step_by_step_pages.submit_for_2i.label"),
bold: true,
},
id: "additional-comments",
textarea_id: "additional-comments",
name: "additional_comments",
} %>
<% end %>
Expand Down
4 changes: 2 additions & 2 deletions app/views/step_by_step_pages/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
text: t("step_by_step_pages.form.introduction.label"),
bold: true,
},
id: "step_by_step_page_introduction",
textarea_id: "step_by_step_page_introduction",
name: "step_by_step_page[introduction]",
value: step_by_step_page.introduction,
} %>
Expand All @@ -59,7 +59,7 @@
text: t("step_by_step_pages.form.meta_description.label"),
bold: true,
},
id: "step_by_step_page_meta_description",
textarea_id: "step_by_step_page_meta_description",
name: "step_by_step_page[description]",
value: step_by_step_page.description,
} %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
text: t("step_by_step_pages.internal_change_notes.label"),
bold: true,
},
id: "internal-change-note-description",
textarea_id: "internal-change-note-description",
name: "internal_change_note[description]",
} %>
<% end %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/steps/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
},
textarea: {
name: "step[contents]",
id: "step-content",
textarea_id: "step-content",
rows: 20,
value: step.contents,
},
Expand Down
12 changes: 6 additions & 6 deletions spec/components/markdown_editor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
textarea: {
name: "markdown-editor",
id: "markdown-editor",
textarea_id: "markdown-editor",
}

assert_select ".govuk-label[for='markdown-editor']", text: "Body"
Expand All @@ -30,7 +30,7 @@
},
textarea: {
name: "markdown-editor",
id: "markdown-editor",
textarea_id: "markdown-editor",
}

assert_select ".app-c-markdown-editor__toolbar-button[title='Bullets']", count: 1
Expand All @@ -44,7 +44,7 @@
},
textarea: {
name: "markdown-editor",
id: "markdown-editor",
textarea_id: "markdown-editor",
}

assert_select ".app-c-markdown-editor__toolbar-button[title='Heading level 2']", count: 1
Expand All @@ -59,7 +59,7 @@
},
textarea: {
name: "markdown-editor",
id: "markdown-editor",
textarea_id: "markdown-editor",
}

assert_select ".app-c-markdown-editor__toolbar-button[title='Blockquote']", count: 1
Expand All @@ -73,7 +73,7 @@
},
textarea: {
name: "markdown-editor",
id: "markdown-editor",
textarea_id: "markdown-editor",
}

assert_select ".app-c-markdown-editor__toolbar-button[title='Numbered list']", count: 1
Expand All @@ -87,7 +87,7 @@
},
textarea: {
name: "markdown-editor",
id: "markdown-editor",
textarea_id: "markdown-editor",
}

assert_select ".govuk-error-message", text: "Error: Something is wrong"
Expand Down
Loading