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

feat: Hide JS dependant elements unless JS enabled #149

Merged
merged 5 commits into from
Aug 28, 2024

Conversation

jimwashbrook
Copy link
Collaborator

@jimwashbrook jimwashbrook commented Aug 27, 2024

GDS guidelines are to not have functionality that requires JS unless there's an alternative. If there is functionality that needs JS, and there is no alternative, the practice is to hide it for non-JS users.

This PR:

  1. Adds govuk-visually-hidden and aria-hidden to the Print button, and the Feedback section
  2. Adds a script that finds all elements with the class .govuk-visually-hidden
  3. For each element, it removes the class, and sets aria-hidden to undefined

It also ignores certain IDs (at the moment, just one), as the same class is also used in the Footer for the "Support Links" header; assumedly for accessibility.

NOTE: Forked from #148 - which should be merged in first.

@jimwashbrook jimwashbrook force-pushed the fix/hide-js-elements-when-js-disabled branch from 5c55c03 to f511d94 Compare August 28, 2024 08:53
Copy link

@jimwashbrook jimwashbrook merged commit 78cc655 into Development Aug 28, 2024
3 checks passed
@jimwashbrook jimwashbrook deleted the fix/hide-js-elements-when-js-disabled branch August 28, 2024 09:28
@jimwashbrook jimwashbrook mentioned this pull request Aug 28, 2024
jimwashbrook added a commit that referenced this pull request Aug 28, 2024
* fix(print): Move Javascript to <script> element due to CSP

* feat: Hide JS dependant elements unless JS enabled

* chore: move class + attribute one up

* tests: Add E2E tests for feedback + print button

* fix: Exclude cypress tests from sonarcloud
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.

3 participants