-
Notifications
You must be signed in to change notification settings - Fork 385
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
Conversation
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.
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.
assets/src/amp-validation/amp-validated-url-post-edit-screen.js
Outdated
Show resolved
Hide resolved
|
||
domReady( () => { | ||
const errorDetailList = document.querySelector( 'dl.detailed' ); | ||
addAdditionalErrorDetails( errorDetailList ); |
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.
As opposed to using JS for this, couldn't the new dt
/dd
be added in PHP by injecting them before the first <dt>
?
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.
Done in f571c17.
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.
Whew! Great job here. Huge improvement to the UX.
@schlessera @amedina Anything else before merging this?
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' ); | ||
} | ||
); |
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.
@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:
- The
amp-icons
stylesheet here is not only used for the admin bar but also for other parts of the screens. - 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.
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.
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.
if ( | ||
event.target.matches( '.amp-validation-error-status' ) || | ||
event.target.matches( '.amp-validation-error-status-review' ) | ||
) { |
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.
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.
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.
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
<select>
color when toggling between error statesScreenshots
Icons in admin bar:
Updated error index page:
Updated single error page:
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