-
Notifications
You must be signed in to change notification settings - Fork 107
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
Conditional content for radios and checkboxes #603
Conversation
@AdamChrimes @mcheung-nhs I have got this all working as a few people have been asking for it... do you have any additional suggestions for the implementation? |
Had a look on Voiceover on iPhone and it seems to make sense to me in that it says the radio button is in a collapsed state, suggesting that if you select it then it will be expanded with further information. See video here: |
{% for item in params.items %} | ||
{% set id = item.id if item.id else idPrefix + "-" + loop.index %} | ||
{% set name = item.name if item.name else params.name %} | ||
{% set conditionalId = "conditional-" + id %} | ||
{% set hasHint = true if item.hint.text or item.hint.html %} | ||
{% set itemHintId = id + '-item-hint' %} | ||
{%- if item.divider %} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odd indentation going on here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no! It's TABS!
This all looks pretty good to me! Just need to do some browser testing on IE etc but I think it will be OK with the JS polyfills. |
Created a placeholder in the service manual guidance for these: https://github.com/nhsuk/nhsuk-service-manual/pull/609/files |
I've tried the compiled JavasScript (v3.1.0) in the prototype kit and both conditional reveals are working 👍 |
e0cd60b
to
5cc437a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
Added functionality for conditionally showing content when radio buttons or checkboxes are checked.
This has been asked for in this issue: nhsuk/nhsuk-service-manual-community-backlog#173
Functionality matches the following Gov examples:
Tests written... accessibility tested on OSX and iOS... behaviour matches that of Gov. Voiceover doesn't acknowledge aria expanded change but I don't think that is possible on checkboxes. Worth somebody else doing some testing on.
JavaScript has Jest tests written.
Checklist