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

Incorrect type definition for WPNoticeAction and missing docs for type option for notices #17203

Closed
ocean90 opened this issue Aug 26, 2019 · 1 comment
Assignees
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] Notices /packages/notices [Status] In Progress Tracking issues with work in progress [Type] Developer Documentation Documentation for developers

Comments

@ocean90
Copy link
Member

ocean90 commented Aug 26, 2019

  • Notices support a type property which isn't documented yet. The default value is 'default' but can also be 'snackbar'. Should be documented in
    • /**
      * @typedef {Object} WPNotice Notice object.
      *
      * @property {string} id Unique identifier of notice.
      * @property {string} status Status of notice, one of `success`,
      * `info`, `error`, or `warning`. Defaults
      * to `info`.
      * @property {string} content Notice message.
      * @property {string} __unstableHTML Notice message as raw HTML. Intended to
      * serve primarily for compatibility of
      * server-rendered notices, and SHOULD NOT
      * be used for notices. It is subject to
      * removal without notice.
      * @property {boolean} isDismissible Whether the notice can be dismissed by
      * user. Defaults to `true`.
      * @property {WPNoticeAction[]} actions User actions to present with notice.
      *
      */
    • /**
      * Yields action objects used in signalling that a notice is to be created.
      *
      * @param {?string} status Notice status.
      * Defaults to `info`.
      * @param {string} content Notice message.
      * @param {?Object} options Notice options.
      * @param {?string} options.context Context under which to
      * group notice.
      * @param {?string} options.id Identifier for notice.
      * Automatically assigned
      * if not specified.
      * @param {?boolean} options.isDismissible Whether the notice can
      * be dismissed by user.
      * Defaults to `true`.
      * @param {?boolean} options.speak Whether the notice
      * content should be
      * announced to screen
      * readers. Defaults to
      * `true`.
      * @param {?Array<WPNoticeAction>} options.actions User actions to be
      * presented with notice.
      */
  • For WPNoticeAction, callback should be onClick, see https://github.com/WordPress/gutenberg/blob/master/packages/components/src/snackbar/index.js#L55-L63.
@ocean90 ocean90 added [Type] Developer Documentation Documentation for developers Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] Notices /packages/notices labels Aug 26, 2019
@simono simono mentioned this issue Aug 26, 2019
5 tasks
@simono
Copy link
Contributor

simono commented Aug 26, 2019

@ocean90 I've tried to fix this in #17206. What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue An issue that's suitable for someone looking to contribute for the first time [Package] Notices /packages/notices [Status] In Progress Tracking issues with work in progress [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

No branches or pull requests

3 participants