-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #157 from DFE-Digital/chore/simplify-hiding-js-ele…
…ments chore: Simplify hiding js-only elements
- Loading branch information
Showing
4 changed files
with
11 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
<script defer type="module" nonce="@Context.Items["nonce"]"> | ||
import * as govuk from '/js/govuk-frontend.min.js'; | ||
govuk.initAll(); | ||
</script> | ||
function showHiddenElement(element) { | ||
element.classList.remove("govuk-visually-hidden"); | ||
element.ariaHidden = undefined; | ||
} | ||
// unhide all js-only elements when js is enabled | ||
[...document.getElementsByClassName("js-only")].forEach(showHiddenElement) | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
<div class="print-button govuk-visually-hidden" aria-hidden="true"> | ||
<div class="js-only print-button govuk-visually-hidden" aria-hidden="true"> | ||
<button class="govuk-link print-link-button" data-module="print-link" id="print-link" >Print this page</button> | ||
</div> |