nhsuk-frontend icon indicating copy to clipboard operation
nhsuk-frontend copied to clipboard

Add role=button spacebar activation and button debouncing JS

Open andymantell opened this issue 1 year ago • 1 comments

Description

Links which are styled to appear visually like buttons can cause problems for users who might expect the button-like element to be clickable with a spacebar since this is how actual buttons behave. This PR adds some JS brought over from govuk-frontend to shim this behaviour in on top - so that links that look like buttons now also behave like buttons.

I have also brought over the button debouncing functionality from govuk while I was here. Which fixes #796

Checklist

andymantell avatar Aug 12 '22 10:08 andymantell

@andymantell or @Fenwick17 would we want to write some tests for the JS here if we're going to merge into v6?

wa-rren-dev avatar Oct 07 '22 15:10 wa-rren-dev

@andymantell Once theres some tests this could go into the version 6 release rather than version 7 I think

Fenwick17 avatar Nov 17 '22 09:11 Fenwick17

@Fenwick17 Agreed. It's on my radar - will put some in when I next get a moment.

andymantell avatar Nov 17 '22 09:11 andymantell