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

Prevent ACK state of non-modified validation errors from being lost; update validation error icons #4382

Merged
merged 51 commits into from
May 4, 2020

Conversation

pierlon
Copy link
Contributor

@pierlon pierlon commented Mar 13, 2020

Summary

This PR prevents the ACK state of other validation errors from being affected when modifying a single one. Also, it updates the validation error icons.

Fixes #3725
Fixes #3726

Todo

  • Remove validation error count summary from "Validation Error" post metabox
  • Update validation error icons with ones from Dashicons
    • Update icons in admin bar
    • Update icons on error index page
    • Update icons validated URLs page
    • Update icons on single validation error page
    • Update icons on single error index page
    • Update icons used in validation error stylesheet summary
    • Remove red and green AMP SVG icons
  • Toggle 'new' state for validation error row upon approval/disapproval
  • Change validation error status <select> color when toggling between error states
  • Show a warning message in post metabox if there are invalid or removed validation errors that are not approved
  • Add a new row action for Approve/Unapprove on error index page
  • Rebrand “New errors” to “Unapproved errors” on error index page

Screenshots

  • Icons in admin bar:



    image

  • Updated error index page:

  • Updated single error page:
    DeepinScreenshot_select-area_20200504121516

  • Updated 'Validated URLs' page:

  • Updated single 'Validation URL' page (Note: The "Approved" column has since been renamed to "Reviewed"):

  • Toggling markup and reviewed status gives visual feedback:

Checklist

  • My pull request is addressing an open issue (please create one otherwise).
  • My code is tested and passes existing tests.
  • My code follows the Engineering Guidelines (updates are often made to the guidelines, check it out periodically).

@googlebot googlebot added the cla: yes Signed the Google CLA label Mar 13, 2020
Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

As discussed in another channel, I think we would be a bit worse off by implementing this partial solution. To clear the “new” state for all removed validation errors, users would have to flip all validation errors to Kept, click update, and then flip all to Removed. I think we need to defer this until we have a good UI to manage the new/ack state. Let's hold off on this until v1.6 when we have a good design in #3725.

@westonruter westonruter marked this pull request as draft April 10, 2020 17:04
@westonruter westonruter changed the title Prevent ACK state of non-modified validation errors from being lost Prevent ACK state of non-modified validation errors from being lost; update validation error icons Apr 10, 2020
@pierlon
Copy link
Contributor Author

pierlon commented May 3, 2020

Markup status being moved below to the error details section, and also unwrapping <details>:

image


domReady( () => {
const errorDetailList = document.querySelector( 'dl.detailed' );
addAdditionalErrorDetails( errorDetailList );
Copy link
Member

@westonruter westonruter May 3, 2020

Choose a reason for hiding this comment

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

As opposed to using JS for this, couldn't the new dt/dd be added in PHP by injecting them before the first <dt>?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in f571c17.

Copy link
Member

@westonruter westonruter left a comment

Choose a reason for hiding this comment

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

Whew! Great job here. Huge improvement to the UX.

@schlessera @amedina Anything else before merging this?

Comment on lines 250 to 262
add_action(
'admin_bar_init',
static function () {
wp_enqueue_style(
'amp-icons',
amp_get_asset_url( 'css/amp-icons.css' ),
[ 'dashicons', 'admin-bar' ],
AMP__VERSION
);

wp_styles()->add_data( 'amp-icons', 'rtl', 'replace' );
}
);
Copy link
Member

Choose a reason for hiding this comment

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

@pierlon I found an issue. This is not currently getting run in Reader mode. When Reader mode is selected, then no Link icon appears in the header.

I tried moving this code to amp_init and that fixed the issue, but then it revealed two others:

  1. The amp-icons stylesheet here is not only used for the admin bar but also for other parts of the screens.
  2. The stylesheet was being added to every screen in the admin (and the frontend) regardless of whether it was being used.

I've implemented a fix in c4cb9ab.

Copy link
Collaborator

@schlessera schlessera left a comment

Choose a reason for hiding this comment

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

Code generally looks good, except for the way the window reload warning is handled (see comment).

I'm fine with merging it as-is for now, though, and focus on improving that in a more drastic rewrite.

Comment on lines +63 to +66
if (
event.target.matches( '.amp-validation-error-status' ) ||
event.target.matches( '.amp-validation-error-status-review' )
) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is overly simplistic and leads to cases where the warning appears even though, for the user, no change has happened as whatever the user did he also undid again.

Screen Recording 2020-05-04 at 11 18 AM

Fixing this might be overly complicated for now, so I'm fine with keeping as-is as long as we're aware of that issue.

Copy link
Member

Choose a reason for hiding this comment

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

That's a good point, but it's the same behavior as the block editor. You can make a change and then either manually undo the change or click the Undo button, and in both cases clicking reload will show the same AYS dialog. So it's not any worse than what users expect elsewhere in WP.

@westonruter westonruter merged commit 4880f0f into develop May 4, 2020
@westonruter westonruter deleted the fix/4725-ack-validation-errors branch May 4, 2020 15:19
@westonruter westonruter added this to the v1.6 milestone Jun 2, 2020
@westonruter westonruter added the Changelogged Whether the issue/PR has been added to release notes. label Jul 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelogged Whether the issue/PR has been added to release notes. cla: yes Signed the Google CLA Developer Tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validation error status icons The ACK state of all validation errors is lost when changing a single one
5 participants