Closed szepeviktor closed 8 years ago
WP 4.1.1
Please elaborate on your report, following these guidelines.
Any JS or PHP errors in particular?
Does it happen if you disable other plugins / switch to default theme?
Diving into wpseo_dismiss_about
...
On a pristine WP I do not receive the output of die( '1' );
from wpseo_dismiss_about()
.
But wpseo_seen_about_version
is created and the admin notice does not appear again.
It is HTTP/200.
wpseo_seen_about_version
is created on the live site also, so it is OK. Maybe this notice cannot be hidden on the plugin update page.
Should I expect that '1'
in the response?
Excuse me. Firefox Developer version did not understand 1
as JSON. But the response's content type is text/html
.
I assume you had figured out what was causing it to close the issue? :) What was it for our information?
:smiley: I think I've navigated to another admin page before that AJAX request - thus the user meta update - was committed.
On another site, on this URL */wp-admin/post.php?post=1906&action=edit
when I click notice-dismiss
no AJAX is fired. Empty browser console.
Maybe Firefox 41 is the cause?
Closing the notice for the ~20th time, I've got an empty (no parameters, no response) AJAX request and the notice is gone.
How to debug it?
After deleting the user-meta, wpseo_dismiss_about
is fired for the first time on close button click.
In WP installs < 4.2, we include a script that adds the dismiss button to notices. I think the issue might be that this script is either not available or not working properly. I think the issue could be that I am using a restricted keyword event
as an argument for a closure. This will probably not work in some versions of Firefox and Internet Explorer. I will create a PR that fixes this. @szepeviktor could you verify you don't have the issue in Chrome?
On the other hand, it seems the minified JavaScript doesn't contain the restricted keyword and I can infer from your earlier provided details the necessary Javascripts are being included (you are running WP 4.1.1 and you are seeing a dismiss button).
I will have to start debugging in Firefox to see if I can reproduce. Removing the bug label since I am not convinced it's a bug anymore.
On another installation wp-admin/update-core.php
(WP 4.1.1) only the jQuery(this).remove()
is bound, no AJAX is fired on close.
As I would execute it, I comment after lines:
function wpseoMakeDismissible() {
jQuery( '.notice.is-dismissible' ).each( function() {
// find the notice <div>
var $notice = jQuery( this );
// store it in $notice
if ( $notice.find( '.notice-dismiss').empty() ) {
// remove the <button> from the notice
var $button = jQuery( '<button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button>' );
$notice.append( $button );
// replace with this button
$button.on( 'click.wp-dismiss-notice', function( event ) {
// bind to this new button
event.preventDefault();
$notice.fadeTo( 100 , 0, function() {
jQuery(this).slideUp( 100, function() {
jQuery(this).remove();
});
});
});
}
});
}
wpseoMakeDismissible()
and wpseoDismissAbout()
both run on document ready.
I think sometime one, some other times the other runs first.
In my case wpseoDismissAbout()
could bind the AJAX event on the removed button.
@omarreiss I hope this helps.
@szepeviktor thanks, that looks like an excellent lead. I will look into it as soon as I find time :wink:
Notifications had been refactored, old issues no longer relevant.
After updating the 2.2.1 the admin notice with the intro link in it keeps appearing until I click the intro link. Closing with the
X
closes it momentarily but on the next admin page load it appears again.