silverstripe / silverstripe-elemental

Create pages in Silverstripe CMS using content blocks
http://dna.co.nz
BSD 3-Clause "New" or "Revised" License
109 stars 115 forks source link

Review UX for inline validation of elemental blocks #1145

Open maxime-rainville opened 6 months ago

maxime-rainville commented 6 months ago

As a content author, I want clear indication when one of my content block contains invalid data so I remedy the problem.

Context

Elemental has never had proper inline validation before. We are looking at remediating this: https://github.com/silverstripe/silverstripe-elemental/issues/329

This does open a bunch of related questions:

Acceptance criteria

The status quo

Related

maxime-rainville commented 6 months ago

Some very relevant question from @GuySartorelli

There are some UX considerations we need to consider before implementing this, such as:

  • Do invalid blocks get expanded automatically?
  • Do invalid blocks get highlighted e.g. with a red border?
  • How do we display validation errors that apply for a block but aren't for a given field?
  • How do we deal with validation errors in a separate tab on of the block (e.g. settings tab on the block)?
  • What about validation errors for the ElementalArea field itself? Is that in scope?
    • Should those be displayed above (non-standard but means those messages are easier to see and relate to the elemental area) or below (more standard but content authors won't notice them until they scroll past the elemental area)?
  • Should we display a summary of all validation errors in some central place? IIRC that's what you're meant to do for accessibility - though that should probably be for the form (or at least the current tab of the form) as a whole, not just for the elemental area?)
  • Presumably when saving a block from the ... menu on the block itself, its validation error status will change independently from all other blocks (i.e. other blocks which already had visible validation errors will still have those visible validation errors)
GuySartorelli commented 6 months ago

If a block already on the page is in an invalid state, how do we warn you?

This should be treated the same as an invalid value in any field on any form. We shouldn't be treating this differently for elemental than for anything else. i.e. we should only show validation errors after validating, which only happens on form submission.

maxime-rainville commented 6 months ago

I had a catch up with Cassie to discuss the UI questions. This are some of the questions that came out.

Relevant pre-existing UI

Page with validation error in a tab

image

Regular field and LinkField each with validation error

image

LinkField with invalid data

image

Page with bad elemental block after save

image

Toast notifications

We have some pre built Toast notification which could be use validation. They have multiple styles. for different context and degree of badness. image

View Toast in our pattern lib