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

Consider displaying block errors in list view #41747

Open
jameskoster opened this issue Jun 15, 2022 · 10 comments
Open

Consider displaying block errors in list view #41747

jameskoster opened this issue Jun 15, 2022 · 10 comments
Labels
[Feature] List View Menu item in the top toolbar to select blocks from a list of links. Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Type] Enhancement A suggestion for improvement.

Comments

@jameskoster
Copy link
Contributor

Occasionally blocks exist on the canvas that will not render for one reason or another. It was discussed in other issues (#40617) whether we should omit incompatible blocks automatically, but that is tricky because incompatible blocks can be inserted indirectly, like copy/pasting a pattern.

Currently there is no consistent way to handle erroring blocks. Blocks in core tend to throw an error in lieu of their intended rendering:

There are a couple of problems with this:

  1. Blocks can occupy small spaces, and trying to fit a long error message into such a space can really mess with the layout and overall editing experience. Especially if there are many erroring blocks.
  2. Depending on the theme, it's not always clear at a glance whether the error is a legitimate part of the design or not.

As an alternative we might consider highlighting errors in List View:

Screenshot 2022-06-15 at 13 16 03

Here we can style rows to indicate errors (IE make them red), and have space to include a message. The button in the top bar can indicate how many errors there are at a glance.

cc @WordPress/gutenberg-design @ockham @c4rl0sbr4v0

@jameskoster jameskoster added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. [Feature] List View Menu item in the top toolbar to select blocks from a list of links. Needs Design Needs design efforts. labels Jun 15, 2022
@ockham
Copy link
Contributor

ockham commented Jun 15, 2022

Thanks @jameskoster, I quite like this! 🙌 Just to clarify, would we still indicate somehow in the canvas that there is an error with a given block (e.g. by greying them out or adding a red border or something to that effect)?

Also, would the pattern you suggest be amenable to adding buttons to resolve a given error (when possible), as discussed in #40614 and explored in #41603?

@jameskoster
Copy link
Contributor Author

Just to clarify, would we still indicate somehow in the canvas that there is an error with a given block

Good question. I think anything we do on the canvas is going to be afflicted by the two points above, which makes it tricky. As an alternative could we use a Snackbar to alert the user when an incompatible block has been inserted, and include an action to open List View to investigate?

Otherwise I'm inclined to say it doesn't matter too much. It seems more important that the backend / frontend are matching, which hiding the 'broken' blocks will accomplish.

Where there any flows in particular that you had in mind?

Also, would the pattern you suggest be amenable to adding buttons to resolve a given error

In most cases I expect the resolution would be to remove the block, which is already possible within the list view UI. I suppose we'd need to figure out a list of potential actions to determine whether the design can / should accommodate them.

@ockham
Copy link
Contributor

ockham commented Jun 16, 2022

In most cases I expect the resolution would be to remove the block, which is already possible within the list view UI. I suppose we'd need to figure out a list of potential actions to determine whether the design can / should accommodate them.

So for the blocks that prompted me to file #40614 and #40617, the underlying problem is typically a post-specific or site-wide setting that would cause the block not to be rendered in the frontend, e.g.:

In those cases, I thought it would make sense to offer the user an "easy fix" -- a button that would change the underlying setting (here: enable avatars site-wide, or enable commenting for the given post, respectively) so that the relevant block will be shown -- rather than suggesting them to remove the block altogether. (If their intent was to have the block there in the first place, it'd be otherwise more complicated to restore it -- they'd need to find the relevant setting, change it, and then come back to re-insert the block.)

@jameskoster
Copy link
Contributor Author

Thanks for sharing the examples. Yeah I agree it seems fair to include actions like beneath the description for situations like these.

Such examples also make me wonder whether there should be a severity factor applied to the errors. These feel more like warnings as the blocks are not broken per se.

I'm also thinking we might use Snackbars as feedback upon insertion of blocks with errors / warnings.

warning.mp4

@ockham
Copy link
Contributor

ockham commented Jun 17, 2022

Thanks James for this latest iteration -- looks good to me!

Such examples also make me wonder whether there should be a severity factor applied to the errors. These feel more like warnings as the blocks are not broken per se.

Sounds like a good idea 👍

I'm also thinking we might use Snackbars as feedback upon insertion of blocks with errors / warnings.

Also sounds good!

Some errors / warnings might occur after the fact, i.e. the block is already part of a post (or template) when a setting is changed. But maybe it's fair to display the snackbar when the user opens the editor the next time? (As long as it's not too many blocks / warnings at once, I guess.)

@jameskoster
Copy link
Contributor Author

Ah yes good point. Disabling comments on a post when the comments form block is already present for example. I think it would be ok to utilise the snackbar there, and to combine multiple errors into a single Snackbar to avoid pollution.

It's probably something we'd have to feel out through some experimentation. The Snackbar may not even be necessary if we did something with the notification number on the list view button.

@jameskoster
Copy link
Contributor Author

Leaving a note that this could also be a way to alert users to un-configured or empty blocks within a document.

@draganescu
Copy link
Contributor

I think this is a good solution to stop showing messages in the canvas.

Users of assistive tech would still have to know they have broken or unconfigured blocks, so the blocks should still be "present" and focusable so the problems can be announced. This would make for invisible tabstops, and be a bit confusing in navigation mode as you'd move the caret in places that seem empty. How could we mitigate that visually?

Also for reasons of cognitive accessibility I think we should stick to snackbars instead of relying solely on the notification count on the list view.

@jasmussen
Copy link
Contributor

Not just users of assistive technologies, anyone. List view (or document outline) come to mind, but also the pre-publish flow could have a panel that lists unconfigured blocks.

I'd use the default blueberry unread dot we use in a few other places, though, and consider having levels of error, such as "warning" (markup error, missing plugin) vs. "notice" (smaller issues like missing link or what brought us here, no pages which is harmless but good to know).

By including it in the pre-publish flow, we not only surface any issues before publishing, we surface it to folks who might not use the list view.

@jameskoster
Copy link
Contributor Author

Agreed on Snackbars, there's a demo including them in this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] List View Menu item in the top toolbar to select blocks from a list of links. Needs Design Feedback Needs general design feedback. Needs Design Needs design efforts. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants