[wp-trac] [WordPress Trac] #38342: Quick Draft: Leverage REST API endpoints

WordPress Trac noreply at wordpress.org
Thu Nov 24 11:35:19 UTC 2016


#38342: Quick Draft: Leverage REST API endpoints
-------------------------------------+-------------------------------------
 Reporter:  adamsilverstein          |       Owner:  joehoyle
     Type:  enhancement              |      Status:  assigned
 Priority:  normal                   |   Milestone:  Future Release
Component:  Administration           |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch 4.8-early      |     Focuses:  accessibility,
  needs-unit-tests                   |  javascript, rest-api
-------------------------------------+-------------------------------------

Comment (by afercia):

 Hello everyone :)

 Replying to [comment:68 adamsilverstein]:
 > * Added calls to wp.a11y.speak() for success and failure when adding a
 draft. (not sure why but I didn't hear failures in voiceover/chrome
 although the code executed).

 That's probably because of this bug: #36853

 Also, I'd recommend to use the `assertive` parameter when calling
 `wp.a11y.speak()`, this way the success/error messages will be announced
 immediately, without waiting for the screen reader to finish what it's
 currently reading out.

 I'd suggest to review a bit the error messages too. Currently, the visible
 ones are based on a try/catch and when there is a response that returns an
 error the message is:
 1 - "Content, title, and excerpt are empty."
 when there is no response:
 2 - "An error has occurred. Please reload the page and try again."

 Instead, the audible error message is always the same:
 3 - "An error has occurred. Please reload the page and try again."

 About 1, there's no "excerpt" field here. I see the API uses
 `wp_insert_post()` but the message is not appropriate in this case.

 About 3, not sure why it should be different from the visual one. I'd say
 it should be paired with the visual messages to distinguish the two cases.

 Other quirks noticed about error handling:

 1
 after a draft is created successfully:
 leave empty the form and submit again
 no error message is displayed

 2
 refresh the page
 leave empty the form and submit again
 the error message is correctly displayed
 now fill the form fields and submit
 the new draft is correctly created but the error message is still
 displayed

 3
 the error notice is displayed with the wrong colors, it currently uses a
 wrong CSS class `notice-info` should be `notice-error` instead

 Lastly, I'd consider to avoid inline styles e.g. `style="display: none;"`,
 and use the CSS class `hidden` when possible.

 I'm also noticing a couple more things that should be probably improved
 about date formatting and doubled entries, will try to post later after
 some more testing.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/38342#comment:74>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list