govuk_tech_docs 4.1.1 → 4.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d3e848b2f3145907e130147476ebd629df69ac468e69348e9de3c1362c0263b6
4
- data.tar.gz: 5afa9c3b6a40237ad08c18c255d4fb381baff1911b981ae7136e23f94e2a52a3
3
+ metadata.gz: 8841e718fe072372cd281eafe72f331dee10d7c5beb8f02afaba8c8472adccb7
4
+ data.tar.gz: 11dab6217737ba9fa9d1c1057a620e12bd810d6c133b64e8f2d6eee40e698b8c
5
5
  SHA512:
6
- metadata.gz: e748131fd5124335034686063131b98309bb83c7e709b633a6e21fee145db1f44f173ed0b7f063036993f580192b0ad532fca19dba245d9f31579b9fa469a2f2
7
- data.tar.gz: b182f9398a855d96927c3a0c103e353c271a348d3d5eb8f35a0329d541b23b8b1b655b44aff6648987939dc2b0707012be443a30396c78ca576024ae1c2ce677
6
+ metadata.gz: 82d6f742cfbe4619a9ffc77c3c19d011d0292ce514be213a70c5aab407132d98b0515a89b94de53367c46fa22b3c11237a631bd3b39198945ffd655efd09ad6f
7
+ data.tar.gz: 14c8bb34c9b140edfb7d114887119306fe70c140a6ad343946e5ba152767ad99a417946874795c6778387a8d35da0d20b60e486eb4b4942420ad99a40d318a79
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 4.1.2
2
+
3
+ ## Fixes
4
+
5
+ - [Fix focus issues with table of contents and main content pane](https://github.com/alphagov/tech-docs-gem/pull/381)
6
+
1
7
  ## 4.1.1
2
8
 
3
9
  ## Fixes
data/Rakefile CHANGED
@@ -1,10 +1,18 @@
1
1
  require "bundler/gem_tasks"
2
2
  require "rspec/core/rake_task"
3
- require "jasmine"
4
3
 
5
4
  RSpec::Core::RakeTask.new(:spec)
6
5
 
7
- load "jasmine/tasks/jasmine.rake"
6
+ namespace :jasmine do
7
+ desc "Test JavaScript with headless browser"
8
+ task :ci do
9
+ sh "npm test"
10
+ end
11
+ desc "Test JavaScript in browser"
12
+ task :server do
13
+ sh "npm run test-server"
14
+ end
15
+ end
8
16
 
9
17
  desc "Lint Ruby and JavaScript"
10
18
  task :lint do
@@ -39,6 +39,7 @@ Gem::Specification.new do |spec|
39
39
  spec.add_dependency "base64" # TODO: remove once middleman-sprockets declares this itself.
40
40
  spec.add_dependency "bigdecimal" # TODO: remove once activesupport declares this itself.
41
41
  spec.add_dependency "chronic", "~> 0.10.2"
42
+ spec.add_dependency "concurrent-ruby", "1.3.4" # 1.3.5 introduced a change that breaks activesupport, and so middleman
42
43
  spec.add_dependency "csv" # TODO: remove once tilt declares this itself.
43
44
  spec.add_dependency "haml", "~> 6.0"
44
45
  spec.add_dependency "middleman", "~> 4.0"
@@ -57,7 +58,6 @@ Gem::Specification.new do |spec|
57
58
 
58
59
  spec.add_development_dependency "byebug"
59
60
  spec.add_development_dependency "capybara", "~> 3.32"
60
- spec.add_development_dependency "jasmine", "~> 3.5"
61
61
  spec.add_development_dependency "rake", "~> 13.0"
62
62
  spec.add_development_dependency "rspec", "~> 3.9"
63
63
  spec.add_development_dependency "rubocop-govuk", "~> 4.10"
@@ -104,7 +104,6 @@
104
104
  function openNavigation () {
105
105
  $html.addClass('toc-open')
106
106
 
107
- toggleBackgroundVisiblity(false)
108
107
  updateAriaAttributes()
109
108
  $toc.focus()
110
109
  }
@@ -112,25 +111,30 @@
112
111
  function closeNavigation () {
113
112
  $html.removeClass('toc-open')
114
113
 
115
- toggleBackgroundVisiblity(true)
116
114
  updateAriaAttributes()
117
- }
118
-
119
- function toggleBackgroundVisiblity (visibility) {
120
- $('.toc-open-disabled').attr('aria-hidden', visibility ? '' : 'true')
115
+ $openButton.focus()
121
116
  }
122
117
 
123
118
  function updateAriaAttributes () {
124
119
  var tocIsVisible = $toc.is(':visible')
125
- var openButtonIsVisible = $openButton.is(':visible')
120
+ var tocIsDialog = $openButton.is(':visible')
126
121
 
127
122
  $($openButton).add($closeButton)
128
123
  .attr('aria-expanded', tocIsVisible ? 'true' : 'false')
129
124
 
130
125
  $toc.attr({
131
126
  'aria-hidden': tocIsVisible ? 'false' : 'true',
132
- role: openButtonIsVisible ? 'dialog' : null
127
+ role: tocIsDialog ? 'dialog' : null
133
128
  })
129
+
130
+ $('.app-pane__content').attr('aria-hidden', (tocIsDialog && tocIsVisible) ? 'true' : 'false')
131
+
132
+ // only make main content pane focusable if it scrolls independently of the toc
133
+ if (!tocIsDialog) {
134
+ $('.app-pane__content').attr('tabindex', '0')
135
+ } else {
136
+ $('.app-pane__content').removeAttr('tabindex')
137
+ }
134
138
  }
135
139
 
136
140
  function preventingScrolling (callback) {
@@ -61,3 +61,10 @@
61
61
  }
62
62
  }
63
63
 
64
+ .app-pane__content:focus-visible,
65
+ .app-pane__content:has(main:focus-visible) {
66
+ outline: $govuk-focus-width solid transparent;
67
+ box-shadow:
68
+ 0 0 0 4px $govuk-focus-colour,
69
+ 0 0 0 8px $govuk-focus-text-colour;
70
+ }
@@ -1,3 +1,3 @@
1
1
  module GovukTechDocs
2
- VERSION = "4.1.1".freeze
2
+ VERSION = "4.1.2".freeze
3
3
  end
@@ -58,7 +58,7 @@
58
58
  </div>
59
59
  <% end %>
60
60
 
61
- <div class="app-pane__content toc-open-disabled" aria-label="Content" tabindex="0">
61
+ <div class="app-pane__content toc-open-disabled" aria-label="Content">
62
62
  <main id="content" class="technical-documentation" data-module="anchored-headings">
63
63
  <%= yield %>
64
64
  <%= partial "layouts/page_review" %>