From e2ac841feb8a859e0373552015ffb46c08e0a4d7 Mon Sep 17 00:00:00 2001 From: Gemma Leigh Date: Thu, 11 Aug 2016 15:45:34 +0100 Subject: [PATCH 1/2] Include the Shim links with button role script from the frontend toolkit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Links styled to look like buttons lack button behaviour. This script will allow them to be triggered with a space key after they’ve been focused, to match standard buttons. By default, this behaviour will only be applied to links with a role of button. --- app/views/includes/scripts.html | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/includes/scripts.html b/app/views/includes/scripts.html index ab53fece6..434f496f9 100644 --- a/app/views/includes/scripts.html +++ b/app/views/includes/scripts.html @@ -3,6 +3,7 @@ + From 2a775df70d2e8e1ae45997445bdf216f81b4f5d5 Mon Sep 17 00:00:00 2001 From: Gemma Leigh Date: Thu, 11 Aug 2016 15:58:51 +0100 Subject: [PATCH 2/2] Use the GOV.UK shim-links-with-button-role.js script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, this behaviour will only be applied to links with a role of button. A button This script will allow them to be triggered with a space key after they’ve been focused, to match standard buttons. --- public/javascripts/application.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public/javascripts/application.js b/public/javascripts/application.js index 2635d20d8..f4540ac75 100644 --- a/public/javascripts/application.js +++ b/public/javascripts/application.js @@ -122,6 +122,10 @@ $(document).ready(function() { var $blockLabels = $(".block-label input[type='radio'], .block-label input[type='checkbox']"); new GOVUK.SelectionButtons($blockLabels); + // Use GOV.UK shim-links-with-button-role.js to trigger a link styled to look like a button, + // with role="button" when the space key is pressed. + GOVUK.shimLinksWithButtonRole.init(); + // Details/summary polyfill // See /javascripts/vendor/details.polyfill.js