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

Conditional content for radios and checkboxes #603

Merged
merged 18 commits into from
Apr 23, 2020

Conversation

tomdoughty
Copy link
Contributor

@tomdoughty tomdoughty commented Apr 17, 2020

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

@tomdoughty tomdoughty added the work in progress Work in progress, not ready for review label Apr 17, 2020
@tomdoughty
Copy link
Contributor Author

@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?

@mcheung-nhs
Copy link
Collaborator

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:
https://mcheung-nhs.github.io/accessibility/tests/nhs.uk/radio-conditional.mov
This is the same behaviour as that of gov's version.

@tomdoughty tomdoughty removed the work in progress Work in progress, not ready for review label Apr 20, 2020
@tomdoughty tomdoughty changed the title WIP- Conditional content for radios and checkboxes Conditional content for radios and checkboxes Apr 20, 2020
@tomdoughty tomdoughty requested review from chrimesdev and mcheung-nhs and removed request for chrimesdev April 20, 2020 12:58
packages/common.js Outdated Show resolved Hide resolved
packages/components/checkboxes/checkboxes.js Outdated Show resolved Hide resolved
{% 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 %}
Copy link
Contributor

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

Copy link
Contributor

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!

packages/components/radios/README.md Outdated Show resolved Hide resolved
@chrimesdev
Copy link
Member

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.

@chrimesdev
Copy link
Member

Created a placeholder in the service manual guidance for these: https://github.com/nhsuk/nhsuk-service-manual/pull/609/files

@chrimesdev
Copy link
Member

I've tried the compiled JavasScript (v3.1.0) in the prototype kit and both conditional reveals are working 👍

@chrimesdev chrimesdev force-pushed the feature/173-conditional-inputs branch from e0cd60b to 5cc437a Compare April 23, 2020 15:15
@davidhunter08 davidhunter08 self-requested a review April 23, 2020 15:18
Copy link
Contributor

@davidhunter08 davidhunter08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@davidhunter08 davidhunter08 merged commit 4a8edd4 into master Apr 23, 2020
@davidhunter08 davidhunter08 deleted the feature/173-conditional-inputs branch April 23, 2020 15:31
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.

6 participants