Privacy: Reposition pointer to ensure dismiss link is always visible.

r43158 introduced a new admin pointer for the privacy tools added in 4.9.6. With the previous positioning, though, sometimes the `Dismiss` link would be fixed off screen, making it impossible for the user to dismiss the pointer. This happened when there were enough extra menu items, or when the viewport height was short enough.

This commit repositions the pointer to work around that problem. One down side of this workaround is that the arrow will not always be positioned next to the `Tools` menu, where it should be. That's an acceptable compromise given the current time constraints, though. A long term solution would be to make `WP_Pointer` robust enough to handle this use case.

Props imath, audrasjb, desrosj.
Fixes #44045.


git-svn-id: https://develop.svn.wordpress.org/trunk@43246 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ian Dunn 2018-05-12 17:28:30 +00:00
parent 239471ade4
commit 4773a48012
2 changed files with 13 additions and 2 deletions

View File

@ -170,18 +170,20 @@ final class WP_Internal_Pointers {
if ( is_rtl() ) {
$position = array(
'edge' => 'right',
'align' => 'left',
'align' => 'bottom',
);
} else {
$position = array(
'edge' => 'left',
'align' => 'right',
'align' => 'bottom',
);
}
$js_args = array(
'content' => $content,
'position' => $position,
'pointerClass' => 'wp-pointer arrow-bottom',
'pointerWidth' => 420,
);
self::print_js( 'wp496_privacy', '#menu-tools', $js_args );
}

View File

@ -207,6 +207,15 @@
content: " ";
}
.wp-pointer.arrow-bottom .wp-pointer-content {
margin-bottom: -45px;
}
.wp-pointer.arrow-bottom .wp-pointer-arrow {
top: 100%;
margin-top: -30px;
}
/* Disable pointers at responsive sizes */
@media screen and ( max-width: 782px ) {
.wp-pointer {