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

Tabs are not functional when CSS is loaded but JavaScript is not #5115

Closed
ahosgood opened this issue Jul 1, 2024 · 2 comments
Closed

Tabs are not functional when CSS is loaded but JavaScript is not #5115

ahosgood opened this issue Jul 1, 2024 · 2 comments
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) javascript sass / css tabs

Comments

@ahosgood
Copy link

ahosgood commented Jul 1, 2024

Description of the issue

The tabs component work perfectly with JavaScript and CSS enabled.

If CSS is disabled then the tabs revert to just a list of links and headings which also works fine.

When JavaScript is disabled (or fails to load) but CSS does load then the tabs are non-functional - I can't get to tabs other than the initial one.

Steps to reproduce the issue

I tested this with https://design-system.service.gov.uk/components/tabs/default/ in Chrome by blocking all network requests to *.js.

Actual vs expected behaviour

It would probably be preferable that the tabs component continue to work when CSS is available and JavaScript is not.

Environment (where applicable)

  • Browser/OS: Latest Chrome on Mac OS (although this applies to all browser/OS combinations)
  • GOV.UK Frontend Version: 5.4.0
@ahosgood ahosgood added awaiting triage Needs triaging by team 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) labels Jul 1, 2024
@querkmachine
Copy link
Member

This isn't a case of JavaScript being disabled, but rather that some JavaScript is being ran whilst other JavaScript is not, due to the blocked network requests.

There is a line of JS embedded in the template that tests early on if JavaScript modules are supported and, if so, adds a class to the root that activates additional styles on various components, on the assumption that the component JS will follow later on. https://github.com/alphagov/govuk-frontend/blob/main/packages/govuk-frontend/src/govuk/template.njk#L29

In the event that those further JS requests fail, are blocked or missing, these components will 'fail unsafe', as described in #999.

We do the module support check up-front for performance reasons. Otherwise the page's content will be rendered, then the check will occur and cause the page's content to be re-rendered. By doing the check up-front, the page only has to render once.

It's something we do want to resolve, but it's not easy without compromising on performance and subsequently web vitals score.

@romaricpascal romaricpascal changed the title Accordions are not functional when CSS is loaded but JavaScript is not Tabs are not functional when CSS is loaded but JavaScript is not Sep 10, 2024
@romaricpascal
Copy link
Member

Closing as a duplicate of #999

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working the way it should (including incorrect wording in documentation) javascript sass / css tabs
Projects
None yet
Development

No branches or pull requests

3 participants