-
Notifications
You must be signed in to change notification settings - Fork 304
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
Notification / messaging guidelines #693
base: main
Are you sure you want to change the base?
Conversation
535f149
to
e2e4d1b
Compare
content/ui-patterns/messaging.mdx
Outdated
|
||
**Highlights**: bring attention to how and why to engage with a feature | ||
**Feedback**: Communicates the result of a user action (subitting a form, toggling a setting, etc.) Feedback can be positive, negative, or a warning. Feedback is shown in either a **Banner** or **Inline message**. For forms, an inline message is used for individual field validation which may be combined with a banner if multiple fields have errors. Banners are typically placed near the top of the page, but still within the body content. Inline messages are placed near the action they are related to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure where this belongs, but I think it's important to emphasize that feedback is placed near the source where possible. For example:
- A form error summary should be placed right above the form it relates.
- If we want to communicate that a user action failed, the feedback should be placed near where the action was taken rather than all the way at the top of the page (especially if this feedback is shown async).
This will help improve discoverability of the feedback for everyone!
In our Rails pages, a lot of feedback is shown on page reload above the <main>
content, but I think this is a pattern we can move away from in our React pages/async interactions.
content/ui-patterns/messaging.mdx
Outdated
|
||
**Updates**: inform the user of necessary updates or changes to the product as it relates to them. | ||
**Awareness**: Communicates information that is relevant to the user but not necessarily related to an action they've taken. This type of message is typically used to provide context or additional information about a feature or product. A **Callout** might be used to suggest an action or helpful tip, while a **Popover** is typically used to announce a new feature and offers a link to learn more. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we warn that Callout and Banners usage should be reserved/limited on a page?
Plaintext can be used for most information. There's also, just a typical plaintext form caption for providing supplementary information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. I could see some guidelines like this:
- avoid using callouts and banners next to each other if possible
- never use multiple callouts after each other
I don't really know how we could create a rule to create a hard limit. I think guidelines is the best we can do, but please let me know if you have ideas for more precise rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm yeah, I'm not quite what the precise rule should be, but I like your suggested guidelines to start with!
On the tooling side, we could consider creating a custom axe rule that flags when there's like.. more than X number of callouts and banners on a given page, or when there are directly adjacent banners/callouts in the DOM.
content/ui-patterns/messaging.mdx
Outdated
- the system is experiencing temporary problems that impact the quality of service but do not make working completly impossible | ||
|
||
|
||
### Error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen "danger"/red variant used to communicate when an action is super destructive or something needs immediate attention. Is that appropriate, and would that fall under this state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question.
One the one side, technically it would be invalid because it is not an error state it is a warning state.
On the other side it is a pattern our users have grown accustomed too, so it may be dangerous to change this.
@langermank what do you think?
I feel like it would make sense to extend this definition to include destructive actions, this is also why we use the danger button, which is red as well.
Co-authored-by: Lukas Oppermann <lukasoppermann@github.com>
Co-authored-by: Lukas Oppermann <lukasoppermann@github.com>
Co-authored-by: Lukas Oppermann <lukasoppermann@github.com>
Co-authored-by: Lukas Oppermann <lukasoppermann@github.com>
content/ui-patterns/messaging.mdx
Outdated
@@ -7,25 +7,157 @@ import {Box} from '@primer/react' | |||
|
|||
Primer includes three different messaging components: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to rethink the purpose of this page. "Messaging" is a very broad term that includes more than the listed components. You already removed "Popover", which makes sense to me. Maybe it would help to further scope this to "Notifications". For example:
Notifications play a crucial role in communicating with users and offering feedback. They vary from detailed, inline reactions to specific user actions, to broader messages that span across the system.
content/ui-patterns/messaging.mdx
Outdated
(image of banner in context) | ||
(image of inline message in context) | ||
|
||
### Unavailable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The degraded experience where no content is shown is sort of an empty state. Data exists but could not be loaded. I wouldn't consider that a system notification respectively, it's documented as part of the existing degraded experience docs already and in the scope of notifications, it doesn't fit. It would fit if it's "messaging" though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't agree that this is not related to messaging. I think it makes sense to at least mention it in these docs and link to degraded experience docs, as I have below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might not need explicit UI elements to show it though. Visual treatment could be added to existing UI to show that data has failed to fetch (e.g. we use spinners to show data is loading, we could provide a new UI pattern that shows data has failed to load that is similar to a spinner, such as an X) - such treatment would be discrete from a banner, and more specific.
- _Flash alerts are best suited for this type of messaging._ | ||
(image here) | ||
|
||
## Message states |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we make this a table for easier overview/consumption? For example something like this:
Status | Usage | Action | Color | Icon |
---|---|---|---|---|
Informational | Used for non-critical context and information. Examples: view impacts, feature prompts, ongoing processes. | Can be dismissed or left to persist based on the significance of the information. | Blue | info |
Success | Indicates task completion or successful actions. Examples: confirmation of saved settings, successful issue transfers. | Can be dismissed or remain in view without intruding. | Green | check-circle |
Warning | Alerts users to potential issues or impactful changes. Examples: important settings, possible connectivity concerns. | Requires acknowledgement, often remains visible until the user responds. | Yellow | alert |
Error/Critical | Signals critical errors, system failures, or necessary destructive actions. Examples: form submission errors, critical confirmations. | Stays visible until the user addresses the issue or completes the required action. | Red | stop |
content/ui-patterns/messaging.mdx
Outdated
- [Banner](../components/flash) | ||
- [Popover](../components/popover) | ||
- Toast | ||
- Callout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that Callout is not a way to notify users, it's about emphasizing content. I would mention it as part of Banner and refer to it, but wouldn't want to confuse to use it for notifications (unless this page continues to be about all things messaging but it's getting a lot).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some small comments here as a first pass.
It's a bit harder to review guidance for banners/toasts until we're sure that we want to allow for toasts. I agree with the confusion on callout vs banner though. In general I think more images and examples will help this!
### Visual treatment | ||
|
||
Primer offers five states for messaging components: info, warning, success, unavailable, and critical. Each state has a corresponding icon and color combination to help communicate the message's intent. | ||
|
||
Icons sized at 14px and above utilize the outline variant, while smaller icons utilize the filled variant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would move the section up to the top of message states since the image is relevant to this section and it also helps people visualize as they go through each of the states
Co-authored-by: Chelsea Adelman <40274682+ichelsea@users.noreply.github.com>
Co-authored-by: Chelsea Adelman <40274682+ichelsea@users.noreply.github.com>
Co-authored-by: Chelsea Adelman <40274682+ichelsea@users.noreply.github.com>
content/ui-patterns/messaging.mdx
Outdated
|
||
Examples: | ||
- a setting that impacts the current view | ||
- a nudge towards a new feature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- a nudge towards a new feature |
A marketing banner should be used instead.
One big issue we have is that users are not sure which state to use. So, I am trying to define the differences here.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some initial thoughts
|
||
**Highlights**: bring attention to how and why to engage with a feature | ||
**Feedback**: Communicates the result of a user action (submitting a form, toggling a setting, etc.) Feedback can be positive, negative, or a warning. Feedback is shown in either a **Banner** or **Inline message**. For forms, an inline message is used for individual field validation which may be combined with a banner if multiple fields have errors. Banners are placed at the top of the page or section they are related to, but still within the body content. Inline messages are placed near the action they are related to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would a banner be preferred over, say, multiple inline messages?
content/ui-patterns/messaging.mdx
Outdated
Use the `info` state to highlight messages that help users complete a task or that provide additional context. This state is only used for information that is not critical to the user's experience. | ||
|
||
Examples: | ||
- a setting that impacts the current view |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where could this be seen? I am imagining this is part of a form? Is this complementary info in a form field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not necessarily a form like you'd imagine. It could be information on any page that helps you perform the action by understanding what you are doing. Or by explaining why you may not see something you expect to see (e.g. you have a settings file that hides it.)
content/ui-patterns/messaging.mdx
Outdated
Examples: | ||
- a setting that impacts the current view | ||
- a nudge towards a new feature | ||
- a process is in progress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would a banner or toast be used instead of a spinner or interstitial page, or are they included in this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you are referring to the last point:
- a process is in progress
If a loading spinner works, this is preferred. But sometimes there may be a need to show a message as well. Either one that includes the loading spinner or if the process is running for a long time and the user may leave the page and come back. In those cases, info
would be the correct state.
Maybe you have an idea of how to better write this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think I've ever seen an interstitial page at GitHub 😆 we'll try and add an image for this one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
content/ui-patterns/messaging.mdx
Outdated
<img | ||
width="960" | ||
alt="draft wip" | ||
src="https://github.com/primer/css/assets/18661030/3fa52b6d-7e33-4f27-b0ec-d836375fe21a" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This flow chart lacks a lot of nuance. I worry people may make a distinction that feature announcements are one bucket, and any other messaging falls in the bucket of banner. In reality we'd want to steer engineers away from banners as much as possible, and more toward inline messaging.
content/ui-patterns/messaging.mdx
Outdated
|
||
### Success | ||
|
||
Use the `success` state to notify users that the results of an action were successful if it is not apparent from the UI. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is not apparent from the UI already, maybe there could be guidance on how it could be made apparent from the UI?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel this is not the correct page for this kind of guidance. If we have this somewhere or add this (great idea) we could link it.
However it is not always possible to make it apparent in the UI.
content/ui-patterns/messaging.mdx
Outdated
Use the `success` state to notify users that the results of an action were successful if it is not apparent from the UI. | ||
|
||
Examples: | ||
- saving an account setting if its otherwise not clear the save has taken place |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sounds like poor UX. It should be evident, without the need for a banner/toast, that a change I have made has been propagated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not always simple, e.g. when saving on a settings page with a text field, we don't redirect. So, it visually looks the same after the save.
I am actually not sure this really is poor UX or to put it a different way, I have no immediate solution that is better.
content/ui-patterns/messaging.mdx
Outdated
(image of banner in context) | ||
(image of inline message in context) | ||
|
||
### Unavailable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might not need explicit UI elements to show it though. Visual treatment could be added to existing UI to show that data has failed to fetch (e.g. we use spinners to show data is loading, we could provide a new UI pattern that shows data has failed to load that is similar to a spinner, such as an X) - such treatment would be discrete from a banner, and more specific.
This PR is a WIP to define guidelines for banner / toast and alert usage.