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

Add post on improving accessibility of Rails forms #153

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

peteryates
Copy link
Member

No description provided.

@peteryates peteryates force-pushed the add-finishing-touches-for-forms-post branch from fc7cc3b to 185fdaf Compare December 21, 2024 23:36
If there are errors we can add the 'Error:' prefix:

```ruby
def page_title(text, error: false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason not to recommend our existing helper here? https://govuk-components.netlify.app/helpers/title-with-error-prefix/ 😄

Copy link
Member Author

Choose a reason for hiding this comment

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

🤦‍♂️

Oh dear, I forgot it was there. I'll amend the post 😅 Thank you!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Haha, doh! I’m not sure it’s yet widely used in DfE repos as it was added after most of them already had their own helper?

This causes a few problems.

The GOV.UK design system includes some complex rules around linking to fields from the error summary. For example, errors on checkbox or radio button fields should link to the first checkbox or radio button.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This bit isn’t explained in the post. Worth adding a separate section to explain link_errors: true?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, this post needs three things; two seems too few!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Header image too! 😀

@paulrobertlloyd
Copy link
Contributor

paulrobertlloyd commented Dec 22, 2024

I've got a great idea for an illustration… will rustle something up in a bit!


The [GOV.UK formbuilder](https://govuk-form-builder.netlify.app) makes it easy for Ruby on Rails developers to build forms that follow the rules set out in the [GOV.UK design system](https://design-system.service.gov.uk/).

It takes care of the markup, provides a nice API for customising the fields to meet the needs of your service and takes care of clearly dispalying any error messages.
Copy link
Member Author

Choose a reason for hiding this comment

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

Typo in 'displaying'

Copy link
Collaborator

@frankieroberto frankieroberto left a comment

Choose a reason for hiding this comment

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

Some minor suggestions.

app/posts/finishing-touches-for-forms.md Outdated Show resolved Hide resolved
url: https://github.com/peteryates
---

The [GOV.UK formbuilder](https://govuk-form-builder.netlify.app) makes it easy for Ruby on Rails developers to build forms that follow the rules set out in the [GOV.UK design system](https://design-system.service.gov.uk/).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
The [GOV.UK formbuilder](https://govuk-form-builder.netlify.app) makes it easy for Ruby on Rails developers to build forms that follow the rules set out in the [GOV.UK design system](https://design-system.service.gov.uk/).
The [GOV.UK formbuilder](https://govuk-form-builder.netlify.app) makes it easy for Ruby on Rails developers to build forms that follow the rules set out in the [GOV.UK Design System](https://design-system.service.gov.uk/).

@paulrobertlloyd
Copy link
Contributor

@peteryates Added an illustration – home you like it!? Also simplified the side-by-side example image, making it less busy and a smaller file size.

@paulrobertlloyd paulrobertlloyd changed the title Add post on improving accessibilty of Rails forms Add post on improving accessibility of Rails forms Dec 22, 2024
@peteryates
Copy link
Member Author

I love the graphic at the top 🤩

Thanks for the feedback, I think I've addressed it and added the third section on link_errors.

app/posts/finishing-touches-for-forms.md Outdated Show resolved Hide resolved
app/posts/finishing-touches-for-forms.md Show resolved Hide resolved
end
```

Now when there's a validation error, regardless of whether the user is an admin or not the error summary will link to the first option. It's a good idea to write some tests to ensure future changes don't affect it.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need a concluding paragraph? Something about how these finishing touches will make the world of difference to users or something (trite?) like that?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is we'd need a heading to make it clear the summary is for the post rather than for the third tip.

end
```

This would make it impossible for the error summary to accurately link to the first check box or radio button without repeating the logic --- an approach that's going to lead to bugs when it's updated in one place but not the other.
Copy link
Contributor

Choose a reason for hiding this comment

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

How does --- render?

Copy link
Member Author

Choose a reason for hiding this comment

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

Em dash.

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.

3 participants