Skip to content

Commit

Permalink
Merge pull request #1085 from alphagov/focus-state-on-extensive-relat…
Browse files Browse the repository at this point in the history
…ed-content

Fixes focus state spacing on 'extensive' related navigation links
  • Loading branch information
injms authored Sep 6, 2019
2 parents efe273f + ce41140 commit 62774a8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
useful summary for people upgrading their application, not a replication
of the commit log.

## Unreleased
* Fixes focus state spacing on 'extensive' related navigation links ([PR #1085](https://github.com/alphagov/govuk_publishing_components/pull/1085))

## 20.1.0

* Add FAQPage schema ([PR #1087](https://github.com/alphagov/govuk_publishing_components/pull/1087))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@
@include govuk-template-link-focus-override;
}

.gem-c-related-navigation__link--truncated-links {
margin-top: govuk-spacing(2);
}

.gem-c-related-navigation__toggle {
@include govuk-link-common;
@include govuk-link-style-no-visited-state;
display: none;

.js-enabled & {
display: block;
display: inline-block;
}
}

Expand All @@ -79,6 +83,10 @@
@include govuk-template-link-focus-override;
}

.gem-c-related-navigation__section-link--inline {
line-height: 1.45;
}

// reset the default browser styles
.gem-c-related-navigation__link-list {
padding: 0;
Expand All @@ -87,8 +95,16 @@
margin-bottom: 1.25em;
}

.gem-c-related-navigation__toggle-more.js-hidden {
.js-enabled & {
display: none;
.gem-c-related-navigation__toggle-more {
.gem-c-related-navigation__section-link {
@include govuk-media-query($from: tablet) {
line-height: 1.45;
}
}

&.js-hidden {
.js-enabled & {
display: none;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
link_element = link_to(
link[:text],
link[:path],
class: related_nav_helper.section_css_class("gem-c-related-navigation__section-link", section_title, link),
class: related_nav_helper.section_css_class("gem-c-related-navigation__section-link", section_title, link, (index >= section_link_limit)),
rel: link[:rel],
lang: related_nav_helper.t_locale_check(link[:locale]),
data: {
Expand Down Expand Up @@ -60,7 +60,7 @@
</a>
</li>

<li class="gem-c-related-navigation__link">
<li class="gem-c-related-navigation__link gem-c-related-navigation__link--truncated-links">
<span id="toggle_<%= section_title %>" class="gem-c-related-navigation__toggle-more js-hidden">
<%= to_sentence(constructed_link_array) %>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ def construct_section_heading(section_title)
end
end

def section_css_class(css_class, section_title, link = {})
css_classes = [css_class, "#{css_class}--#{@context}"]
def section_css_class(css_class, section_title, link = {}, link_is_inline = false)
css_classes = [css_class]
css_classes << "#{css_class}--#{@context}" unless @context.nil?
css_classes << "#{css_class}--inline" if link_is_inline

unless DEFINED_SECTIONS.include?(section_title) || link.fetch(:finder, false)
css_classes << " #{css_class}--other"
Expand Down

0 comments on commit 62774a8

Please sign in to comment.