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

Preview v5: Skip initialisation when GOV.UK Frontend is not supported #2976

Merged
merged 2 commits into from
Aug 1, 2023

Conversation

colinrotherham
Copy link
Contributor

This PR updates .js-enabled to .govuk-frontend-supported as we did for:

Added separately to #2958 as lots of functionality is broken until we preview v5

@colinrotherham colinrotherham added this to the v5.0 milestone Jul 26, 2023
@netlify
Copy link

netlify bot commented Jul 26, 2023

You can preview this change here:

Name Link
🔨 Latest commit f5f35e4
🔍 Latest deploy log https://app.netlify.com/sites/govuk-design-system-preview/deploys/64c8b5ad0d0a34000888079b
😎 Deploy Preview https://deploy-preview-2976--govuk-design-system-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@colinrotherham colinrotherham changed the title Skip initialisation when GOV.UK Frontend is not supported Preview v5: Skip initialisation when GOV.UK Frontend is not supported Jul 26, 2023
Copy link
Contributor

@domoscargin domoscargin 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 to me!

@@ -3,7 +3,7 @@ class BackToTop {
* @param {Element} $module - HTML element
*/
constructor ($module) {
if (!($module instanceof HTMLElement)) {
if (!($module instanceof HTMLElement) || !document.body.classList.contains('govuk-frontend-supported')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

All these identical constructor-y bits just make me want to do a base component sooner!

This closes the support gap for browsers without ES module support still loading JavaScript-only styles
Base automatically changed from v5-types to release/5.0 August 1, 2023 15:37
@colinrotherham colinrotherham merged commit 01bf8df into release/5.0 Aug 1, 2023
@colinrotherham colinrotherham deleted the v5-supported-check branch August 1, 2023 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

2 participants