From 8df3d82a745cd2b9a0981ee66e2ddeec118312e5 Mon Sep 17 00:00:00 2001 From: Paul Craig Date: Wed, 15 Feb 2017 00:12:34 +0000 Subject: [PATCH] Add 'button' role to link button template Another of the changes pulled in in the latest template is that links with a role="button" can be targeted by a script that will treat them the same as buttons. This means you can press the space bar when they're focused and it should register a click. Frontend apps will have to set up their javascript independently, but the button role will be in the markup from now on. Source: https://github.com/alphagov/govuk_frontend_toolkit/pull/297 --- pages_builder/assets/javascripts/onready.js | 9 +++++++++ pages_builder/pages/link-button.yml | 2 ++ toolkit/templates/link-button.html | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/pages_builder/assets/javascripts/onready.js b/pages_builder/assets/javascripts/onready.js index 7a1fa552..e51db00f 100644 --- a/pages_builder/assets/javascripts/onready.js +++ b/pages_builder/assets/javascripts/onready.js @@ -32,9 +32,18 @@ GOVUK.GDM.validation(); } + if (GOVUK.shimLinksWithButtonRole) { + console.log('1'); + GOVUK.shimLinksWithButtonRole.init({ + selector: '[class^=link-button]' + }); + } + if (GOVUK.ShowHideContent) { var showHideContent = new GOVUK.ShowHideContent() showHideContent.init() } })(window); + +$(document).on('click', function() { console.log('click'); }); \ No newline at end of file diff --git a/pages_builder/pages/link-button.yml b/pages_builder/pages/link-button.yml index 1410265e..e540b048 100644 --- a/pages_builder/pages/link-button.yml +++ b/pages_builder/pages/link-button.yml @@ -2,6 +2,8 @@ pageTitle: Link buttons assetPath: ../govuk_template/assets/ head: > +bodyEnd: > + examples: - label: View service diff --git a/toolkit/templates/link-button.html b/toolkit/templates/link-button.html index af732ade..f8637a61 100644 --- a/toolkit/templates/link-button.html +++ b/toolkit/templates/link-button.html @@ -1 +1 @@ -{{ label }} +{{ label }}