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

Forms checklist #321

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Forms checklist #321

wants to merge 3 commits into from

Conversation

sonniesedge
Copy link
Contributor

Some checklists to follow when building forms.

A work in progress, so don't expect it to be anywhere near perfect just yet. But happy to receive comments even at this stage.


### Minimise the number of fields to fill out

### Mark optional fields
Copy link
Contributor

Choose a reason for hiding this comment

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

  • Yes ☀️ it is preferred over the * (required) pattern
  • If they are optional, it might be worse to re-evaluate if they are really needed after all and if they might not be getting in the way to conversion


### Accessibility

### Label every input
Copy link
Contributor

Choose a reason for hiding this comment

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

Do not hesitate to provide the most information possible so that the user succeed rather than get into validation issue. Not a good feeling to have.
Therefore you could divide the label into 2 parts, the label itself (e.g Date of birth) and a hint (e.g DD/MM/YYYY basically what you often find in placeholder).
A good practice is also to nest the inline error message inside of the label so that it will be spoken by Assistive tech when focused.


- For preference, enhance it! Make it part of the brand!

### Don't ask users to repeat their email address
Copy link
Contributor

Choose a reason for hiding this comment

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

nor password (see "show password" below)


### Don't split data fields

### Avoid dropdown menus
Copy link
Contributor

Choose a reason for hiding this comment

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

Use radio buttons for single option and checkbox for multiple options when a decent amount of options are available (below 8)


- Don't use placeholders!

### Offer help text
Copy link
Contributor

Choose a reason for hiding this comment

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

Mostly as hint in labels as stated above


### Provide examples of input

- Don't use placeholders!
Copy link
Contributor

Choose a reason for hiding this comment

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

Use label hints instead as stated above

markup/forms.md Outdated

### Offer help text

### Masked input
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this to be a good practice until I read something that challenged it. The reasons do not come out from the top of my head atm, therefore I would research that one. Though Estelle Weyl has a great framework agnostic accessible input masking library


### Explain clearly why you need any private information

### Use autocomplete when useful
Copy link
Contributor

Choose a reason for hiding this comment

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

as an enhancement


### Use fieldsets and legends

### Make use of native validation, enhance when necessary
Copy link
Contributor

Choose a reason for hiding this comment

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

Excerpt of the Form Design Pattern that may challenge it:

"While HTML5 validation support is quite good, it’s not implemented uniformly. For example, the required attri- bute can mark fields as invalid from the outset, which isn’t desirable. Some browsers, such as Firefox 45.7, will show an error of “Please enter an email address” even if the user entered something in the box, whereas Chrome, for example, says “Please include an ‘@’ in the email address,” which is more helpful.
We also want to give users the same interface whether errors are caught on the server or the client. For these rea- sons we’ll design our own solution. The first thing to do is turn off HTML5 validation:" using the novalidate attribute on the form element.


- https://www.smashingmagazine.com/2018/08/best-practices-for-mobile-form-design/
- https://github.com/cferdinandi/bouncer
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/forms/Basic_form_hints
Copy link
Contributor

Choose a reason for hiding this comment

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

@morgaan
Copy link
Contributor

morgaan commented Aug 20, 2019

Hi Charlie, this looks already like quite a good draft. Lot of points I would put ❤️ on. I was supposed to bring that contribution to the playbook, but being busy on NatCar, so I'm glad you fire started it. I added a few comments from things I learned from the Form Design Patterns book which I found relevant. Hope it's alright 😊


### Don't ask users to repeat their email address

### Provide a "show password" option
Copy link
Contributor

@jpw jpw Aug 20, 2019

Choose a reason for hiding this comment

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

"... as a progressive enhancement" ? Hmmm related, should we have a pwd confirmation field and remove it as part of the same PE? Just thinking out loud here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point! Thinking out loud too: Then maybe two password inputs in raw HTML. When JS available, then enhance to "show password" feature the first one, and turn the other one into a hidden input and sync what is typed in first one so that the BE/FE contract stays the same with or without JS. Sounds like a bit of work already, therefore it (or any better implementation) could qualifiy as a component candidate for the Design system/Global toolkit I believe


### Provide a "show password" option

### Don't split data fields
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this mean please?

Copy link
Contributor

Choose a reason for hiding this comment

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

For instance Date: [ ] / [ ] / [ ] (3 fields). Just a guess though


### Use autocomplete when useful

### Enable auto-filling of personal details
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@jpw
Copy link
Contributor

jpw commented Aug 20, 2019

Great idea, lovely stuff. Might want to add a bit about sane default values? 😁 https://github.com/springernature/frontend-playbook/blob/master/security/secure-markup.md#use-sane-form-defaults


### Mark optional fields

- Highlight form fields that are _optional_, rather than highlighting fields that are required.
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but why? Can we link out to any research?


### Label every input

### Use the most simple form control that does the job
- Every input must have a corresponding label.
- We prefer separate labels linked via a `for` attribute, rather than labels that wrap around the input.
Copy link
Contributor

Choose a reason for hiding this comment

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

Why?

### Client-side validation
- Part of the Core experience, so every form should be initially built to the Core standards.
- Data should be validated on the server, and a form with inline messages for any errors encountered.
- All data being sent to a server must be sanitised, so server-side validation is always necessary.
Copy link
Contributor

Choose a reason for hiding this comment

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

I would add "The most basic web security rule is "Never Trust the Client"."

### Accessibility
### Allow client-side validation to occur

- Client-side validation is a supplement to server-side validation, not a replacement.
Copy link
Contributor

Choose a reason for hiding this comment

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

"Client-side validation is a progressive enhancement of server-side validation" ?

- Consider removing optional form fields: if they are optional then why is the data being collected?
- Fewer fields means less cognitive work for the user!

### Minimise the number of fields to fill out
Copy link
Contributor

Choose a reason for hiding this comment

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

this heading appears to relate to the previous line

@sonniesedge sonniesedge marked this pull request as draft September 24, 2020 12:17
Base automatically changed from master to main March 17, 2021 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants