govuk_publishing_components 5.1.1 → 5.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 27265d058d967524df2d0e420fab53b2bf9278d739dea1ed7aa8e20245413c8e
4
- data.tar.gz: 20bfd7b105a9ddc4ed0464f10c6ed9c365e9edc9d267564a42c82c9a694c9ebf
3
+ metadata.gz: 82107111f850c84527a2eac1c33b99019069fd5fc4a1683f7b88f0cdae8dd30f
4
+ data.tar.gz: f0d5265c99e46d8edec4adb3e9023cd26d08f690c2717454f497c33b7593638a
5
5
  SHA512:
6
- metadata.gz: 257c88b5dfadd6be3226e70a304d8d46e98c01926931ea9883f06dbe19d9a6cfcc16aa29973f56f1ec1b2a5a9fedd0bcc2819b040ffdc4fe2e64868560f06245
7
- data.tar.gz: 37d7712fdce99007ba80f968f097ef0e449145a7a800eafbb74dc8ec739c412357805b0122695dbf636387dba63325b30c8732b83b839b974ca59e4fa4564898
6
+ metadata.gz: 12665b69dcfd60f4ed3e336aecf494cb5c0cfb425fd61e9efc512d405790e6fdddc9b66f4723418beb12cd97bf0e2b5edad6b47b6490d6697230268f44c75b60
7
+ data.tar.gz: 0e73ce2217730591b427993c0274cb80896eae3da8bac9f63d257421f5556a686975e970078c361c3a0b49c740f311607831a85ffc03d389bf4cf108574ebaf8
@@ -95,7 +95,7 @@
95
95
  linkText = actions.hideLinkText;
96
96
  }
97
97
  if (!$(this).find('.js-toggle-link').length) {
98
- $(this).append('<span class="gem-c-step-nav__toggle-link js-toggle-link">' + linkText + '</span>');
98
+ $(this).find('.js-step-title-button').append('<span class="gem-c-step-nav__toggle-link js-toggle-link" aria-hidden="true">' + linkText + '</span>');
99
99
  }
100
100
  });
101
101
  }
@@ -155,22 +155,29 @@
155
155
  var $title = $step.find('.js-step-title');
156
156
  var contentId = $step.find('.js-panel').first().attr('id');
157
157
 
158
+ $title.wrapInner(
159
+ '<span class="js-step-title-text"></span>'
160
+ );
161
+
158
162
  $title.wrapInner(
159
163
  '<button ' +
160
164
  'class="gem-c-step-nav__button gem-c-step-nav__button--title js-step-title-button" ' +
161
165
  'aria-expanded="false" aria-controls="' + contentId + '">' +
162
- '</button>' );
166
+ '</button>'
167
+ );
163
168
  });
164
169
  }
165
170
 
166
171
  function bindToggleForSteps(stepNavTracker) {
167
172
  $element.find('.js-toggle-panel').click(function (event) {
168
173
  preventLinkFollowingForCurrentTab(event);
174
+ var $step = $(this).closest('.js-step');
169
175
 
170
- var stepView = new StepView($(this).closest('.js-step'));
176
+ var stepView = new StepView($step);
171
177
  stepView.toggle();
172
178
 
173
- var toggleClick = new StepToggleClick(event, stepView, $steps, stepNavTracker);
179
+ var stepIsOptional = typeof $step.data('optional') !== 'undefined' ? true : false;
180
+ var toggleClick = new StepToggleClick(event, stepView, $steps, stepNavTracker, stepIsOptional);
174
181
  toggleClick.track();
175
182
 
176
183
  setShowHideAllText();
@@ -308,8 +315,7 @@
308
315
  var $stepContent = $stepElement.find('.js-panel');
309
316
  var shouldUpdateHash = rememberShownStep;
310
317
 
311
- this.title = $stepElement.find('.js-step-title').text();
312
- this.href = $titleLink.attr('href');
318
+ this.title = $stepElement.find('.js-step-title-text').text().trim();
313
319
  this.element = $stepElement;
314
320
 
315
321
  this.show = show;
@@ -377,29 +383,17 @@
377
383
  history.replaceState({}, '', newLocation);
378
384
  }
379
385
 
380
- function StepToggleClick(event, stepView, $steps, stepNavTracker) {
386
+ function StepToggleClick(event, stepView, $steps, stepNavTracker, stepIsOptional) {
381
387
  this.track = trackClick;
382
388
  var $target = $(event.target);
383
389
 
384
390
  function trackClick() {
385
391
  var tracking_options = {label: trackingLabel(), dimension28: stepView.numberOfContentItems().toString()}
386
392
  stepNavTracker.track('pageElementInteraction', trackingAction(), tracking_options);
387
-
388
- if (!stepView.isHidden()) {
389
- stepNavTracker.track(
390
- 'stepNavLinkClicked',
391
- String(stepIndex()),
392
- {
393
- label: stepView.href,
394
- dimension28: String(stepView.numberOfContentItems()),
395
- dimension29: stepView.title
396
- }
397
- )
398
- }
399
393
  }
400
394
 
401
395
  function trackingLabel() {
402
- return $target.closest('.js-toggle-panel').attr('data-position') + ' - ' + stepView.title + ' - ' + locateClickElement() + ": " + stepNavSize;
396
+ return $target.closest('.js-toggle-panel').attr('data-position') + ' - ' + stepView.title + ' - ' + locateClickElement() + ": " + stepNavSize + isOptional();
403
397
  }
404
398
 
405
399
  // returns index of the clicked step in the overall number of steps
@@ -426,12 +420,16 @@
426
420
  }
427
421
 
428
422
  function clickedOnHeading() {
429
- return $target.hasClass('js-step-title-button');
423
+ return $target.hasClass('js-step-title-text');
430
424
  }
431
425
 
432
426
  function iconType() {
433
427
  return (stepView.isHidden() ? 'Minus' : 'Plus');
434
428
  }
429
+
430
+ function isOptional() {
431
+ return (stepIsOptional ? ' ; optional' : '');
432
+ }
435
433
  }
436
434
 
437
435
  function componentLinkClick(event, stepNavTracker, linkPosition) {
@@ -23,14 +23,4 @@
23
23
  @include bold-24;
24
24
  }
25
25
 
26
- .gem-c-step-nav-header__skip-link {
27
- position: absolute;
28
- top: 0;
29
- right: 9999em;
30
-
31
- &:focus {
32
- right: 0;
33
- }
34
- }
35
-
36
26
  // scss-lint:enable SelectorFormat
@@ -30,7 +30,13 @@ $top-border: solid 2px $grey-3;
30
30
  }
31
31
 
32
32
  .gem-c-step-nav {
33
- margin-bottom: $gutter-half;
33
+ margin-bottom: $gutter;
34
+
35
+ &.gem-c-step-nav--large {
36
+ @include media(tablet) {
37
+ margin-bottom: $gutter * 2;
38
+ }
39
+ }
34
40
  }
35
41
 
36
42
  .gem-c-step-nav__controls {
@@ -69,6 +75,11 @@ $top-border: solid 2px $grey-3;
69
75
  position: relative;
70
76
  z-index: 1; // this and relative position stops focus outline underlap with border of accordion
71
77
  padding: 0.5em 0;
78
+ text-decoration: underline;
79
+
80
+ &:hover {
81
+ color: $link-hover-colour;
82
+ }
72
83
 
73
84
  .gem-c-step-nav--large & {
74
85
  @include _core-font-generator(16px, 14px, 16px, 1, 1, false);
@@ -104,21 +115,6 @@ $top-border: solid 2px $grey-3;
104
115
  }
105
116
  }
106
117
 
107
- .gem-c-step-nav__step--optional {
108
- // broken line down the side of a step
109
- &:after {
110
- border-left-style: dotted;
111
- }
112
-
113
- .gem-c-step-nav--large & {
114
- @include media(tablet) {
115
- &:after {
116
- border-width: $stroke-width-large;
117
- }
118
- }
119
- }
120
- }
121
-
122
118
  .gem-c-step-nav__step:last-child {
123
119
  // little dash at the bottom of the line
124
120
  &:before {
@@ -238,7 +234,8 @@ $top-border: solid 2px $grey-3;
238
234
  }
239
235
 
240
236
  &:hover {
241
- .gem-c-step-nav__button {
237
+ .gem-c-step-nav__button,
238
+ .gem-c-step-nav__circle {
242
239
  color: $link-colour;
243
240
  }
244
241
 
@@ -321,12 +318,6 @@ $top-border: solid 2px $grey-3;
321
318
  }
322
319
  }
323
320
 
324
- .gem-c-step-nav__links--required {
325
- .gem-c-step-nav__link-item {
326
- font-weight: bold;
327
- }
328
- }
329
-
330
321
  .gem-c-step-nav__links--choice {
331
322
  $links-margin: 20px;
332
323
 
@@ -380,6 +371,7 @@ $top-border: solid 2px $grey-3;
380
371
 
381
372
  .gem-c-step-nav__link-item {
382
373
  color: $black;
374
+ text-decoration: none;
383
375
 
384
376
  &:visited,
385
377
  &:active,
@@ -389,14 +381,6 @@ $top-border: solid 2px $grey-3;
389
381
  }
390
382
  }
391
383
 
392
- .gem-c-step-nav__link-item {
393
- text-decoration: none;
394
-
395
- &:hover {
396
- text-decoration: underline;
397
- }
398
- }
399
-
400
384
  .gem-c-step-nav__context {
401
385
  display: inline-block;
402
386
  font-weight: normal;
@@ -421,12 +405,6 @@ $top-border: solid 2px $grey-3;
421
405
  height: calc(100% + #{$gutter});
422
406
  }
423
407
 
424
- .gem-c-step-nav__step--optional & {
425
- &:after {
426
- display: none;
427
- }
428
- }
429
-
430
408
  .gem-c-step-nav--large & {
431
409
  @include media(tablet) {
432
410
  &:after {
@@ -47,7 +47,7 @@
47
47
  </div>
48
48
  </div>
49
49
 
50
- <form action="/contact/govuk/problem_reports" id="something-is-wrong" class="gem-c-feedback__form js-feedback-form js-hidden" data-track-category="yesNoFeedbackForm" data-track-action="ffFormSubmit">
50
+ <form action="/contact/govuk/problem_reports" id="something-is-wrong" class="gem-c-feedback__form js-feedback-form js-hidden" data-track-category="yesNoFeedbackForm" data-track-action="ffFormSubmit" method="post">
51
51
  <a href="#" class="gem-c-feedback__close gem-c-feedback__js-show js-close-form" aria-controls="something-is-wrong" aria-expanded="true" role="button">Close</a>
52
52
 
53
53
  <div class="gem-c-feedback__grid-row">
@@ -80,7 +80,7 @@
80
80
  </div>
81
81
  </form>
82
82
 
83
- <form action="/contact/govuk/email-survey-signup" id="page-is-not-useful" class="gem-c-feedback__form gem-c-feedback__form--email gem-c-feedback__js-show js-feedback-form js-hidden" data-track-category="user_satisfaction_survey" data-track-action="banner_taken">
83
+ <form action="/contact/govuk/email-survey-signup" id="page-is-not-useful" class="gem-c-feedback__form gem-c-feedback__form--email gem-c-feedback__js-show js-feedback-form js-hidden" data-track-category="user_satisfaction_survey" data-track-action="banner_taken" method="post">
84
84
  <a href="#" class="gem-c-feedback__close js-close-form" aria-controls="page-is-not-useful" aria-expanded="true" role="button">Close</a>
85
85
 
86
86
  <div class="gem-c-feedback__grid-row">
@@ -34,30 +34,34 @@
34
34
  circle_class = "gem-c-step-nav__circle--logic" if logic
35
35
  %>
36
36
  <li class="gem-c-step-nav__step js-step
37
- <%= "gem-c-step-nav__step--optional" if step[:optional] %>
38
37
  <%= "gem-c-step-nav__step--active" if step_is_active %>"
39
38
  <% if step_is_active %>aria-current="step"<% end %>
40
39
  <%= "data-show" if step_count == show_step %>
41
40
  id="<%= id %>"
42
41
  data-track-count="stepNavSection"
42
+ <%= "data-optional" if step[:optional] %>
43
43
  >
44
- <div class="gem-c-step-nav__circle <%= circle_class %>">
45
- <span class="gem-c-step-nav__circle-inner">
46
- <span class="gem-c-step-nav__circle-background">
47
- <% if logic %>
48
- <%= logic %>
49
- <% else %>
50
- <%
51
- step_number += 1
52
- %>
53
- <span class="visuallyhidden">Step</span> <%= step_number %>
54
- <% end %>
44
+ <div class="gem-c-step-nav__header js-toggle-panel" data-position="<%= "#{step_index + 1}" %>">
45
+ <%= content_tag("h#{heading_level}", class: 'gem-c-step-nav__title') do %>
46
+ <span class="gem-c-step-nav__circle <%= circle_class %>">
47
+ <span class="gem-c-step-nav__circle-inner">
48
+ <span class="gem-c-step-nav__circle-background">
49
+ <% if logic %>
50
+ <%= logic %>
51
+ <% else %>
52
+ <%
53
+ step_number += 1
54
+ %>
55
+ <span class="visuallyhidden">Step</span> <%= step_number %>
56
+ <% end %>
57
+ </span>
58
+ </span>
55
59
  </span>
56
- </span>
57
- </div>
58
60
 
59
- <div class="gem-c-step-nav__header js-toggle-panel" data-position="<%= "#{step_index + 1}" %>">
60
- <%= content_tag("h#{heading_level}", step[:title], class: 'gem-c-step-nav__title js-step-title') %>
61
+ <span class="js-step-title">
62
+ <%= step[:title] %>
63
+ </span>
64
+ <% end %>
61
65
  </div>
62
66
 
63
67
  <div class="gem-c-step-nav__panel js-panel" id="step-panel-<%= id %>-<%= step_index + 1 %>">
@@ -1,8 +1,6 @@
1
1
  <%
2
2
  title ||= false
3
3
  path ||= false
4
- skip_link ||= false
5
- skip_link_text ||= "Skip content"
6
4
  tracking_id ||= false
7
5
  %>
8
6
  <% if title %>
@@ -24,17 +22,5 @@
24
22
  <%= title %>
25
23
  </span>
26
24
  <% end %>
27
-
28
- <% if skip_link %>
29
- <a href="<%= skip_link %>"
30
- class="gem-c-step-nav-header__skip-link"
31
- data-track-category="stepNavHeaderClicked"
32
- data-track-action="top"
33
- data-track-label="<%= skip_link %>"
34
- data-track-dimension="<%= skip_link_text %>"
35
- data-track-dimension-index="29">
36
- <%= skip_link_text %>
37
- </a>
38
- <% end %>
39
25
  </div>
40
26
  <% end %>
@@ -191,7 +191,7 @@ examples:
191
191
  description: |
192
192
  Links can have the following attributes:
193
193
 
194
- - style, an attribute on the parent list that controls its appearance, either required (bold), optional (not bold) or choice (not bold, with bullets on the list). The default is optional.
194
+ - style, an attribute on the parent list that controls its appearance. Defaults to optional but can be set to 'choice' (adds indent and bullets to the list)
195
195
  - context, an optional text field to show some extra information after the link, usually a monetary value
196
196
  - active, whether to make the link highlighted (to indicate the current page)
197
197
  - highlight_step, a general option to highlight the step. Usually the active link would be in the active step, but in some circumstances there might be an active step but no highlighted link.
@@ -212,7 +212,6 @@ examples:
212
212
  },
213
213
  {
214
214
  type: 'list',
215
- style: 'required',
216
215
  contents: [
217
216
  {
218
217
  href: '/component-guide/step_by_step_navigation/with_links/preview',
@@ -232,31 +231,6 @@ examples:
232
231
  }
233
232
  ]
234
233
  },
235
- {
236
- type: 'paragraph',
237
- text: 'These links represent tasks that are optional.'
238
- },
239
- {
240
- type: 'list',
241
- contents: [
242
- {
243
- href: '/component-guide/step_by_step_navigation/with_links/preview',
244
- text: 'Learn to play the saxophone',
245
- active: true
246
- },
247
- {
248
- href: '/component-guide/step_by_step_navigation/with_links/preview',
249
- text: 'Develop a new method of extracting juice from oranges',
250
- context: '&pound;0 to &pound;300',
251
- active: true
252
- },
253
- {
254
- href: '/component-guide/step_by_step_navigation/with_links/preview',
255
- text: 'Buy a race car',
256
- active: true
257
- }
258
- ]
259
- },
260
234
  {
261
235
  type: 'paragraph',
262
236
  text: 'These links represent a choice:'
@@ -285,7 +259,6 @@ examples:
285
259
  contents: [
286
260
  {
287
261
  type: 'list',
288
- style: 'required',
289
262
  contents: [
290
263
  {
291
264
  href: '/component-guide/step_by_step_navigation/',
@@ -362,7 +335,6 @@ examples:
362
335
  },
363
336
  {
364
337
  type: 'list',
365
- style: 'required',
366
338
  contents: [
367
339
  {
368
340
  href: 'http://solicitors.lawsociety.org.uk/',
@@ -384,7 +356,6 @@ examples:
384
356
  },
385
357
  {
386
358
  type: 'list',
387
- style: 'required',
388
359
  contents: [
389
360
  {
390
361
  href: '/looking-after-children-divorce/apply-for-court-order',
@@ -428,7 +399,6 @@ examples:
428
399
  contents: [
429
400
  {
430
401
  type: 'list',
431
- style: 'required',
432
402
  contents: [
433
403
  {
434
404
  href: 'http://google.com',
@@ -457,7 +427,6 @@ examples:
457
427
  contents: [
458
428
  {
459
429
  type: 'list',
460
- style: 'required',
461
430
  contents: [
462
431
  {
463
432
  href: '/component-guide/step_by_step_navigation/with_links/preview',
@@ -480,7 +449,10 @@ examples:
480
449
  ]
481
450
  with_optional_steps:
482
451
  description: |
483
- Steps can be optional. This is controlled by two parameters for maximum flexibility, 'optional' (which causes the step to have a dotted line down the side) and 'logic', which defaults to showing the word 'and' alongside the step title, but also accepts 'or'.
452
+ Steps can be optional. This is controlled by two parameters, 'optional' and 'logic'.
453
+
454
+ - Optional steps used to have a dotted line down the side but this was removed as it confused users. In some cases we may still need to record if a step is optional, so if this parameter is applied, GA tracking events will have 'optional' appended to the end of the eventLabel.
455
+ - Logic will change the number next to a step to the word 'and' or the word 'or'.
484
456
 
485
457
  If a step is optional this should be conveyed by the text within that step.
486
458
  data:
@@ -687,7 +659,6 @@ examples:
687
659
  },
688
660
  {
689
661
  type: 'list',
690
- style: 'required',
691
662
  contents: [
692
663
  {
693
664
  href: 'https://en.wikipedia.org/wiki/HDMI',
@@ -707,7 +678,6 @@ examples:
707
678
  },
708
679
  {
709
680
  type: 'list',
710
- style: 'required',
711
681
  contents: [
712
682
  {
713
683
  href: 'https://www.google.co.uk/',
@@ -730,7 +700,6 @@ examples:
730
700
  },
731
701
  {
732
702
  type: 'list',
733
- style: 'required',
734
703
  contents: [
735
704
  {
736
705
  href: 'http://www.google.com',
@@ -798,7 +767,6 @@ examples:
798
767
  },
799
768
  {
800
769
  type: 'list',
801
- style: 'required',
802
770
  contents: [
803
771
  {
804
772
  href: 'http://www.google.com',
@@ -819,7 +787,6 @@ examples:
819
787
  },
820
788
  {
821
789
  type: 'list',
822
- style: 'required',
823
790
  contents: [
824
791
  {
825
792
  href: 'http://www.google.com',
@@ -883,7 +850,6 @@ examples:
883
850
  },
884
851
  {
885
852
  type: 'list',
886
- style: 'required',
887
853
  contents: [
888
854
  {
889
855
  href: 'https://en.wikipedia.org/wiki/HDMI',
@@ -903,7 +869,6 @@ examples:
903
869
  },
904
870
  {
905
871
  type: 'list',
906
- style: 'required',
907
872
  contents: [
908
873
  {
909
874
  href: 'https://www.google.co.uk/',
@@ -926,7 +891,6 @@ examples:
926
891
  },
927
892
  {
928
893
  type: 'list',
929
- style: 'required',
930
894
  contents: [
931
895
  {
932
896
  href: 'http://www.google.com',
@@ -994,7 +958,6 @@ examples:
994
958
  },
995
959
  {
996
960
  type: 'list',
997
- style: 'required',
998
961
  contents: [
999
962
  {
1000
963
  href: 'http://www.google.com',
@@ -1015,7 +978,6 @@ examples:
1015
978
  },
1016
979
  {
1017
980
  type: 'list',
1018
- style: 'required',
1019
981
  contents: [
1020
982
  {
1021
983
  href: 'http://www.google.com',
@@ -5,9 +5,7 @@ body: |
5
5
  accessibility_criteria: |
6
6
  The component is designed to go into the top of an existing content page and should not interfere with the heading structure of the page, so therefore should not contain a heading tag.
7
7
 
8
- The component must:
9
-
10
- - provide a skip link to the step by step navigation on the page, if one is present
8
+ An early version of the component contained a hidden skip link for keyboard and screen reader users, that jumped to the step by step navigation component in the sidebar (similiar to the 'skip to content' link at the top of all GOV.UK pages). User testing suggested that rather than helping users it confused them, so this has been removed.
11
9
  shared_accessibility_criteria:
12
10
  - link
13
11
  examples:
@@ -24,16 +22,3 @@ examples:
24
22
  title: 'With a tracking id'
25
23
  path: '#'
26
24
  tracking_id: 'this-is-the-tracking-id'
27
- with_a_skip_link:
28
- description: This option allows the insertion of a skip link to a step by step navigation elsewhere on the page. This aids navigation when using a keyboard or screen reader. The skip link is visually hidden until it receives focus.
29
- data:
30
- title: 'Separating from a spouse or civil partner: step by step'
31
- path: /divorce
32
- skip_link: '#step-nav-wrapper'
33
- with_a_skip_link_with_custom_text:
34
- description: It's hard to think of good text to put in a skip link, so this option lets you customise it.
35
- data:
36
- title: 'Buying and renting a property: step by step'
37
- path: /buy-sell-your-home
38
- skip_link: '#step-nav-steps'
39
- skip_link_text: Skip to steps
@@ -86,11 +86,7 @@ private
86
86
  end
87
87
 
88
88
  def get_list_style(style)
89
- if style == "required"
90
- "gem-c-step-nav__links--required"
91
- elsif style == "choice"
92
- "gem-c-step-nav__links--choice"
93
- end
89
+ "gem-c-step-nav__links--choice" if style == "choice"
94
90
  end
95
91
 
96
92
  def get_list_element(style)
@@ -1,3 +1,3 @@
1
1
  module GovukPublishingComponents
2
- VERSION = '5.1.1'.freeze
2
+ VERSION = '5.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_publishing_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-19 00:00:00.000000000 Z
11
+ date: 2018-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails