Repository navigation
Description
Is your feature request related to a problem? Please describe.
This issue is part of a review on the naming, structure, and composition of the UI components as brought up in #16367
These are the current components that are related to messaging that I considered in this issue:
- Modal (highest priority, required action)
- Notice (medium priority, optional action)
- Snackbar (lowest priority, optional action, or no action)
Reminder: these components are used to communicate app processes to the user, and each one has a certain usage and level of priority.
Modal
Audit
Opportunities I came across while reviewing this component.
- See this issue to see why it should be renamed to "Dialog". Modal Component: rename to Dialog #14195
- Lack of standard modal content and actions.
isDismissablewas hard to understand at first, with double negatives in the prop description. “closeButton” or “closeIcon” seems more clear to me.
Suggestions
- Rename component to Dialog.
- We should add more sub components like DialogTitle, DialogContent, DialogFooter, and DialogButton. This will create more consistent Dialogs and makes it easier to use for adding standard elements.
- Consider cleaning up the close action prop names (shouldCloseOnEsc, shouldCloseOnClickOutside, isDismissable). We can make all of them enabled by default. Possible new names:
disableOutsideClickdisableCloseOnEscdisableCloseButton
Notice
Audit
Opportunities I came across while reviewing this component.
- Terms like Notice or Alert can be more general and less descriptive.
- There's seems to be no limit on the number of actions I can provide.
isDismissiblecan be misleading by the description: "whether the notice should be dismissible or not". Even though the icon is not visible, we may provide a dismiss action as one of the action buttons.
Suggestions
- Rename to "Banner".
- Banner is more descriptive than notice or alert and reduces confusion with other “messaging” elements. For example, a "Snackbar" could be considered as a type of notice and/or alert.
- Similar to Snackbar, we should restrict the number of actions to 2 + close icon, instead of an array of actions.
Note
There are some missing features of Notice that you'd normally see in WP Admin. We should enhance this component a bit by:
- Providing an icon option
- Displaying actions as buttons
- Providing an option for a title
Inline Banner
Assuming Banners are meant to be displayed at the top of the viewport, I suggest we create an inline variation, similar to Polaris.
Snackbar
Audit
Opportunities I came across while reviewing this component.
- The guidelines restrict the number of actions in a Snackbar, but the component allows me to add many.
Suggestions
- Add the single
actionas a prop in the component. This will keep the usage of the Snackbar consistent. - Consider consistent of prop naming for when the component is closed (
onRemovevsonClose)
Feedback
The feedback I'm looking for is related to naming, structure, and composition. I'm not looking for visual feedback of the components. I'm also not examining each prop for each component; only the ones that I think are relevant for the audit. I know this issue is a lot to take in, and I appreciate any feedback you have.
- Particularly interested in the rename for Notice to Banner, because it's a rename for an existing component in WP Admin. I'm not sure what implications this may have as these components get more usage outside of the editor.





Activity
davewhitley commentedon Jul 23, 2019
Props audit
As an addendum, here is a deeper evaluation of the props for these components. This is an effort to expand the components to be more useful and to answer the question, "Are properties well thought out and consistently applied?" This only covers visual props. Event handler props will be evaluated at a later date.
Dialog
✨ New
In addition to those props, there are also the DialogTitle, DialogContent, DialogFooter, and DialogButton components.
📋 Rename
Notice
✨ New
📋 Rename
✂️ Remove
👍 No change
Snackbar
✨ New
✂️ Remove
Event handler props will be evaluated at a later date.
mapk commentedon May 12, 2020
I'm closing out the Component Audit issues for now.