Skip to content

Commit

Permalink
Merge pull request #3164 from alphagov/ensure-dashes-no-read-in-corpo…
Browse files Browse the repository at this point in the history
…rate-information

Prevent hyphens being read out by screen readers
  • Loading branch information
beccapearce authored Apr 24, 2024
2 parents 5d6f042 + 1298397 commit 856ee01
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
22 changes: 0 additions & 22 deletions app/assets/stylesheets/views/_worldwide-organisation.scss
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,3 @@
}
}
}

.corporate-information__sub-navigation {
ul {
padding-inline-start: 0;
}

li {
@media (min-width: 1px) { // stylelint-disable-line media-feature-range-notation
list-style: none;
padding-left: $govuk-gutter-half;
@include govuk-responsive-padding(1, "top");

&:before { // stylelint-disable-line selector-pseudo-element-colon-notation
content: "-";
position: relative;
float: left;
width: $govuk-gutter-half;
margin-left: $govuk-gutter-half * -1;
}
}
}
}
12 changes: 5 additions & 7 deletions app/presenters/worldwide_organisation_presenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,21 +99,19 @@ def home_page_offices
end

def show_corporate_info_section?
corporate_information_pages.any? || secondary_corporate_information.present?
corporate_information_pages.present? || secondary_corporate_information.present?
end

def corporate_information_pages
cips = content_item.dig("links", "corporate_information_pages")
return [] if cips.blank?
return if cips.blank?

ordered_cips = content_item.dig("details", "ordered_corporate_information_pages")
return [] if ordered_cips.blank?
return if ordered_cips.blank?

ordered_cips.map do |cip|
{
text: cip["title"],
url: cips.find { |cp| cp["content_id"] == cip["content_id"] }["web_url"],
}
link = cips.find { |cp| cp["content_id"] == cip["content_id"] }["web_url"]
link_to(cip["title"], link, class: "govuk-link").html_safe
end
end

Expand Down
11 changes: 4 additions & 7 deletions app/views/content_items/worldwide_organisation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,10 @@
} %>

<% if @content_item.corporate_information_pages.any? %>
<nav class="group corporate-information__sub-navigation" role="navigation">
<ul class="govuk-list">
<% @content_item.corporate_information_pages.each do |cip| %>
<li lang="<%= @content_item.locale %>"><%= link_to cip[:text], cip[:url], class: "govuk-link" %></li>
<% end %>
</ul>
</nav>
<%= render "govuk_publishing_components/components/list", {
visible_counters: true,
items: @content_item.corporate_information_pages
} %>
<% end %>

<% if @content_item.secondary_corporate_information.present? %>
Expand Down

0 comments on commit 856ee01

Please sign in to comment.