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

Snackbar: Update design documentation and add accessibility documentation. #16038

Closed
wants to merge 2 commits into from

Conversation

kjellr
Copy link
Contributor

@kjellr kjellr commented Jun 7, 2019

This PR adds design and accessibility guidelines for the Snackbar component. This is in addition to the development documentation (and very light design documentation) that existed previously. These guidelines are 'best practices' for the usage of the component, and they describe the component in more detail.

You can preview the updated document here:
https://github.com/WordPress/gutenberg/blob/fa16fa5f777af29958201b320185dc7601c349da/packages/components/src/snackbar/README.md

Thanks @drw158 and @sarahmonster for help drafting this. Looking forward to feedback from everyone! We'd especially love some feedback from folks on the accessibility team, on whether this covers the most important guidelines.

@kjellr kjellr added [Type] Developer Documentation Documentation for developers Needs Design Feedback Needs general design feedback. Needs Accessibility Feedback Need input from accessibility labels Jun 7, 2019
@kjellr kjellr self-assigned this Jun 7, 2019
Copy link
Contributor

@senadir senadir left a comment

Choose a reason for hiding this comment

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

overall, following design guidelines depends on the team, while I'm onboard about the important of design, I'm not sure if we should:

  1. remove code for the sake of following design, therefore not allowing anything multiple buttons or custom buttons
  2. leaving the code as is and adding linter warning about it


![](https://wordpress.org/gutenberg/files/2019/06/snackbar-action-dont2.png)

**Don’t:** Do not use more than one action button in a snackbar.
Copy link
Contributor

Choose a reason for hiding this comment

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

this line conflicts with the code documentation on line 146

  • actions: (array) an array of action objects. Each member object should contain a label and either a url link string or onClick callback function. A className property can be used to add custom classes to the button styles.

I kinda agree more with the design one, snackbar are meant to be informative and low priority, having multiple action would be confusing taking into account the 10s choice period.

while the design docs tells you what you should probably do, the code docs describe what exist and makes no assumption, so I think the actual code should be updated? @youknowriad @kjellr what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the code is as is to be consistent with the Notice component as with the core/notices package, you can just change the "type" of the dispatched action to switch between regular notices and snackbars.

So, I'm on the fence because consistency in APIs is a good thing as well. So I may be leaning towards keeping this as a guideline and not something strict in the API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a great point — thanks for raising it. From a design perspective, I think I'd prefer we were a little more strict about this sort of thing. Mostly because we know that 3rd parties will most certainly abuse the available options and create really distracting/confusing snackbars if we don't.

Copy link
Contributor

Choose a reason for hiding this comment

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

@senadir I think you can attempt a strict refactoring of the props. This would have impact on the notices package though :)


![](https://wordpress.org/gutenberg/files/2019/06/snackbar-action-dont1.png)

**Don’t:** Do not use buttons inside of snackbars.
Copy link
Contributor

Choose a reason for hiding this comment

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

this also falls in the same area as the other comment, class names should not be available to customization because the button should not be customized

A className property can be used to add custom classes to the button styles.

@senadir
Copy link
Contributor

senadir commented Jun 7, 2019

@youknowriad, I can refactor the snackbar component if we're following the strict approach

@paaljoachim
Copy link
Contributor

paaljoachim commented Jul 28, 2020

The PR was brought up during a Gutenberg Design Triage.
The document looks good, and seems ready to be included in the documentation.

@annezazu
Anne do you have any comments here?

@paaljoachim paaljoachim removed the Needs Design Feedback Needs general design feedback. label Jul 28, 2020
@annezazu
Copy link
Contributor

No major comments on my end except that I want to be sure proper accessibility feedback has been incorporated and everything is up to date especially since this is a year old. Otherwise, looks good to proceed with and can be iterated on in the future :)

@paaljoachim
Copy link
Contributor

I am wondering if there should be a "undo" operation option?

For instance:
#17366 (comment)

Base automatically changed from master to trunk March 1, 2021 15:42
@annezazu
Copy link
Contributor

@critterverse thoughts on whether to just close this out or push forward and merge? I'm assuming these updates are still in line with current design thinking :)

@critterverse
Copy link
Contributor

thoughts on whether to just close this out or push forward and merge? I'm assuming these updates are still in line with current design thinking :)

@annezazu Merging this makes sense to me! This documentation aligns nicely with the guidelines around snackbar usage in the WordPress Design Library.

@annezazu
Copy link
Contributor

annezazu commented Apr 4, 2024

This was never moved forward and, two years on, I worry how out of date it is. I'm going to close this out as a result and encourage folks who want to continue working on it to open a new PR.

@annezazu annezazu closed this Apr 4, 2024
@youknowriad youknowriad deleted the update/snackbar-deisgn-a11y-documentation branch April 4, 2024 15:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Accessibility Feedback Need input from accessibility [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants