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

Fixed bug where buttons added after page load don't activate JS behaviours #907

Merged
merged 6 commits into from
Dec 7, 2023

Conversation

andymantell
Copy link
Contributor

@andymantell andymantell commented Nov 30, 2023

Description

  • Add and export new initAll method in nhsuk.js, and pass document by default, but allowing smaller DOM scopes to be passed. This allows new nhsuk-frontend JS components to be initialised after page load, such as in new pieces of DOM added by JavaScript.
    • This fixes issue 906 where button elements added after the page has loaded would not benefit from the button component's JS behaviours (double click prevention and space bar activation for links).

Fixes #906

Checklist

@andymantell andymantell changed the title Fixed bug where buttons added after page load don't activate JS behav… Fixed bug where buttons added after page load don't activate JS behaviours Nov 30, 2023
Copy link
Contributor

@Fenwick17 Fenwick17 left a comment

Choose a reason for hiding this comment

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

Looks all good to me

Copy link
Contributor

@roshaanbajwa roshaanbajwa left a comment

Choose a reason for hiding this comment

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

looks good

@andymantell andymantell merged commit 5692eed into main Dec 7, 2023
2 checks passed
@andymantell andymantell deleted the feature/button-js-fix branch December 7, 2023 10:02
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.

Buttons added after domready don't get button JS behaviour bound to them
3 participants