Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the keyboard shim for link buttons #3027

Merged
merged 1 commit into from
Nov 29, 2022

Conversation

jon-kirwan
Copy link
Contributor

@jon-kirwan jon-kirwan commented Oct 18, 2022

What

Add the keyboard shim for link buttons

Why

As links styled as buttons have the button role, some assistive technology announces 'To activate press space bar'. Links cannot usually be triggered with the space bar, and so we have to shim this behaviour – see alphagov/govuk_elements#272 for more context.

Examples

Button

https://components-gem-pr-3027.herokuapp.com/component-guide/button/default/preview

<button class="gem-c-button govuk-button" type="submit">Submit</button>

Link button

https://components-gem-pr-3027.herokuapp.com/component-guide/button#link_button

<a class="gem-c-button govuk-button" role="button" data-module="govuk-button" draggable="false" href="#" data-govuk-button-module-started="true">I'm really a link sssh</a>

Button (with data attributes)

https://components-gem-pr-3027.herokuapp.com/component-guide/button/with_data_attributes/preview

<button class="gem-c-button govuk-button gem-c-button--bottom-margin" type="submit" data-module="cross-domain-tracking" data-tracking-code="GA-123ABC" data-tracking-name="transactionTracker">Track this!</button>

Link button (with data attributes)

<a class="gem-c-button govuk-button gem-c-button--bottom-margin" role="button" data-module="govuk-button cross-domain-tracking" data-tracking-code="GA-123ABC" data-tracking-name="transactionTracker" draggable="false" href="#" data-govuk-button-module-started="true">Track this!</a>

Link button in application (with data attributes)

https://www.integration.publishing.service.gov.uk/overseas-passports (integration) or http://127.0.0.1:3005/overseas-passports (development)

<a class="gem-c-button govuk-button govuk-button--start gem-c-button--bottom-margin" role="button" rel="external" data-module="govuk-button cross-domain-tracking" data-tracking-code="UA-50679428-3" data-tracking-name="transactionTracker" draggable="false" href="https://www.passport.service.gov.uk/filter" data-govuk-button-module-started="true" data-cross-domain-tracking-module-started="true">  Start now
  <svg class="govuk-button__start-icon govuk-!-display-none-print" xmlns="http://www.w3.org/2000/svg" width="17.5" height="19" viewBox="0 0 33 40" focusable="false" aria-hidden="true">
    <path fill="currentColor" d="M0 0h13l20 20-20 20H0l20-20z"></path>
  </svg>
</a>

@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 October 18, 2022 14:52 Inactive
@jon-kirwan jon-kirwan linked an issue Oct 18, 2022 that may be closed by this pull request
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from b640614 to 546c9ba Compare October 19, 2022 10:05
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 October 19, 2022 10:06 Inactive
@jon-kirwan jon-kirwan self-assigned this Oct 21, 2022
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from 546c9ba to 4c8f9ef Compare October 26, 2022 17:36
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 October 26, 2022 17:37 Inactive
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from 4c8f9ef to b955b29 Compare November 1, 2022 10:13
@govuk-ci govuk-ci had a problem deploying to components-gem-pr-3027 November 1, 2022 10:13 Failure
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from b955b29 to 54a89b4 Compare November 1, 2022 12:46
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 November 1, 2022 12:46 Inactive
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from 54a89b4 to b2b62a4 Compare November 15, 2022 12:01
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 November 15, 2022 12:01 Inactive
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from b2b62a4 to 28d408e Compare November 18, 2022 15:20
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 November 18, 2022 15:20 Inactive
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 November 18, 2022 15:45 Inactive
@jon-kirwan jon-kirwan requested review from MartinJJones and maxgds and removed request for MartinJJones and maxgds November 18, 2022 15:59
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from 68cd824 to 03f0cba Compare November 18, 2022 17:27
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 November 18, 2022 17:27 Inactive
@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from 03f0cba to dc9d03b Compare November 29, 2022 11:53
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 November 29, 2022 11:53 Inactive
Copy link
Contributor

@MartinJJones MartinJJones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me 👍

Only small nitpick would be to remove the extra line in the change log - https://github.com/alphagov/govuk_publishing_components/pull/3027/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR13

@jon-kirwan jon-kirwan force-pushed the add-the-keyboard-shim-for-link-buttons branch from dc9d03b to 5f9092e Compare November 29, 2022 14:58
@govuk-ci govuk-ci temporarily deployed to components-gem-pr-3027 November 29, 2022 14:58 Inactive
@jon-kirwan
Copy link
Contributor Author

Changes look good to me 👍

Only small nitpick would be to remove the extra line in the change log - https://github.com/alphagov/govuk_publishing_components/pull/3027/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4edR13

Good spot and removed ✔️

@jon-kirwan jon-kirwan merged commit 18d08d0 into main Nov 29, 2022
@jon-kirwan jon-kirwan deleted the add-the-keyboard-shim-for-link-buttons branch November 29, 2022 15:01
@AshGDS AshGDS mentioned this pull request Dec 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Links styled as buttons do not include the keyboard shim
3 participants