-
Notifications
You must be signed in to change notification settings - Fork 20
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
Introduce "add another" component #4420
Introduce "add another" component #4420
Conversation
b5cc67c
to
6d5e632
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.
It's looking good 👍 I've just added a couple of smallish comments.
Also, I think the add-another
styles need to be added to the _all_components.scss
stylesheet.
app/assets/stylesheets/govuk_publishing_components/components/_add-another.scss
Show resolved
Hide resolved
app/views/govuk_publishing_components/components/docs/add_another.yml
Outdated
Show resolved
Hide resolved
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.
Are there any accessibility issues with having multiple labels and delete buttons that all share the same name? For example, if a screen reader user navigates the form by buttons using the rotor, could this cause confusion? Would it be worth considering adding a visually hidden element next to each label and delete button to make them uniquely identifiable e.g.
<label>Full name <span class="visually-hidden">1</span></label>
and
<button>Delete <span class="visually-hidden">full name 1</span></button>
Thanks for the review @jon-kirwan! |
6d5e632
to
6b555fe
Compare
6b555fe
to
aadf4e5
Compare
e2487b7
to
f460648
Compare
f460648
to
2b5dd0f
Compare
2b5dd0f
to
85cb35d
Compare
85cb35d
to
28ed297
Compare
28ed297
to
263cef8
Compare
Thanks, that looks better! There's still an issue with identifying the form components with the rotor. However, when using VoiceOver to navigate the page, the unique fieldset is announced each time you tab to an input, which will be helpful |
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.
Great work and thanks for answering all my questions @dnkrj!
263cef8
to
97680d9
Compare
97680d9
to
5b4fb5c
Compare
Hello @dnkrj Just been looking at this - looks really good. The only thing that came to mind was to maybe explain a bit more in the documentation about the empty item: I don't think it's immediately obvious what that does and how it should look. |
This allows classes to be passed to the fieldset component (needed for the add another component)
This is based on the MoJ component and existing component in Whitehall. It is to be used when users need to add similar information a couple of times, such as several featured links for an organisation. An empty field and destroy checkboxes for the existing fields are required and displayed to the user when javascript is disabled in keeping with rails conventions. When Javascript is enabled, an "add another" button is introduced to allow users to add copies of the empty field and the checkboxes replaced with "Delete" buttons which hide the fields and checks the appropriate checkbox.
5b4fb5c
to
0602dc3
Compare
What
Why
Screenshots
To see further examples of usage, the migration PR for Whitehall can be looked at.
With Javascript
Without Javascript