Skip to content

Commit

Permalink
Merge pull request #320 from hmrc/PLATUI-2554
Browse files Browse the repository at this point in the history
PLATUI-2554 Add utility class to hide stuff when javascript is disabled
  • Loading branch information
KatiePocklington committed Sep 28, 2023
2 parents 32c39b3 + 5c2267f commit 27577c0
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 99 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [5.49.0] - 2023-09-27

### Changed

- Add utility class to hide stuff when javascript is disabled

## [5.48.0] - 2023-09-15

### Changed
Expand Down
219 changes: 121 additions & 98 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "hmrc-frontend",
"version": "5.48.0",
"version": "5.49.0",
"description": "Design patterns for HMRC frontends",
"scripts": {
"start": "gulp dev",
Expand Down
1 change: 1 addition & 0 deletions src/components/_all.scss
Expand Up @@ -14,3 +14,4 @@
@import "user-research-banner/user-research-banner";
@import "timeline/timeline";
@import "summary-list/summary-list";
@import "js-visible/js-visible";
7 changes: 7 additions & 0 deletions src/components/js-visible/README.md
@@ -0,0 +1,7 @@
# Utility class to hide stuff when javascript is disabled

It assumes that you are using the GOV.UK template that adds the js-enabled class to the body element

If the js-enabled class is not added to the body element of the page with javascript then the element will always be hidden

The elements are hidden using `display: none;` so will not be read aloud by screen readers or navigable by keyboard when hidden
3 changes: 3 additions & 0 deletions src/components/js-visible/_js-visible.scss
@@ -0,0 +1,3 @@
body:not(.js-enabled) .hmrc-\!-js-visible {
display: none !important;
}

0 comments on commit 27577c0

Please sign in to comment.