#33953 closed defect (bug) (duplicate)
Chrome periodically does not redraw the admin panel after setPinMenu() is called
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 4.3.1 |
| Component: | General | Keywords: | |
| Focuses: | javascript, administration | Cc: |
Description
Note: This might actually be a Chromium bug, but the workaround is only 1 line of code.
The setPinMenu() function (located in wp-admin/js/common.js) adds and removes classes from the body element and for some reason Chrome 45.0.2454.85 (64-bit) on Linux and Opera 32.0.1948.25, which both use Webkit sometimes fail to re-render the menu after this function is called. The error does not exist with Firefox. To reproduce, I usually just refresh and then click on the Dashboard link. It ends up looking like this:
I have also attached a small screencast. Fortunately to fix this, just add the line
$body.hide().show(0);
to the end of setPinMenu(), which forces Chrome to redraw it. So it should look something like:
function setPinMenu() {
resetHeights();
if ( $adminmenu.data('wp-responsive') ) {
$body.removeClass( 'sticky-menu' );
unpinMenu();
} else if ( height.menu + height.adminbar > height.window ) {
pinMenu();
$body.removeClass( 'sticky-menu' );
} else {
$body.addClass( 'sticky-menu' );
unpinMenu();
}
$body.hide().show(0);
}
Attachments (1)
Change History (4)
#2
@
10 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
Hi @deadduck169! This is a really fantastic first ticket. It is a duplicate of #33199, but you've tracked this down in more detail, and it's much appreciated. Chrome should be at 45.0.2454.99 now in stable channels, and this particular issue was fixed in 45.0.2454.93.
#3
@
10 years ago
I'm glad I could help. It really took me a while to track the exact code that reproduces the bug because as soon as a change is made to the page, the menu gets re-rendered correctly. If only I had done a bit more thorough search trying to find the duplicate bug.
Unfortunately it hasn't been pushed to the Google's Debian-based repository yet, but I'm sure it will be soon. Opera, on the other hand, is another story. It will likely be a few months before it gets included there.

Actually, now that I think of it, it is probably inefficient to redraw the whole
window.bodyelement. You can instead just do$adminmenu.hide().show(0);Or maybe selecting a more specific sub-element of
$adminmenuif that is more efficient. Something like:$adminmenu.find("li a").first().hide().show(0);As long as any changes are made to the menu element, Chrome will redraw it.