Skip to content

Commit

Permalink
Use the GOV.UK shim-links-with-button-role.js script
Browse files Browse the repository at this point in the history
By default, this behaviour will only be applied to links with a role of button.
<a class="button" role="button">A button</a>

This script will allow them to be triggered with a space key after they’ve been focused, to match standard buttons.
  • Loading branch information
gemmaleigh committed Aug 19, 2016
1 parent 038cc25 commit baf595f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ $(document).ready(function () {
var $blockLabels = $(".block-label input[type='radio'], .block-label input[type='checkbox']")
new GOVUK.SelectionButtons($blockLabels) // eslint-disable-line

// 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();

// Show and hide toggled content
// Where .block-label uses the data-target attribute
var toggleContent = new ShowHideContent()
Expand Down

0 comments on commit baf595f

Please sign in to comment.